Ansible Environment variables

- hosts: localhost
  vars:
    kubeconfig_path: "{{ lookup('env','KUBECONFIG') }}"
    cloudflare_email: "{{ lookup('env','CF_EMAIL') }}"
export CF_EMAIL=<your_cloudflare_email>
export KUBECONFIG=~/.kube/config
ansible-playbook playbook.yml

References:

  • 1How to Inject Environment Variables into Ansible Playbooks
Previous
Next