gantsign / ansible_role_antigen

Ansible role for installing the Antigen and using it to configure Zsh
https://galaxy.ansible.com/gantsign/antigen
MIT License
27 stars 16 forks source link

Undefined variable ansible_env #49

Open kikearciniegas opened 2 years ago

kikearciniegas commented 2 years ago

Running/testing with default options from the README.md, the playbook fails with the following message:

fatal: [hostname-redacted]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: {{ x_ansible_download_dir | default(ansible_env.HOME + '/.ansible/tmp/downloads') }}: 'ansible_env' is undefined\n\nThe error appears to be in '/Users/username-redacted/.ansible/roles/gantsign.antigen/tasks/install.yml': line 12, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: create download directory\n ^ here\n"}

Where and how should this variable be defined?

Running antigen_version: '2.0.2' | ansible [core 2.11.6] | python version = 3.10.0

Thanks

freemanjp commented 2 years ago

@kikearciniegas thanks for reporting this issue.

This role uses ansible_env.HOME to determine where to download Antigen to.

ansible_env depends on fact-gathering being run on the remote host.

Your playbook probably has:

gather_facts: no

Changing it to yes should fix the issue.