ansible_role_antigen icon indicating copy to clipboard operation
ansible_role_antigen copied to clipboard

Undefined variable ansible_env

Open kikearciniegas opened this issue 3 years ago • 1 comments

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

kikearciniegas avatar Nov 23 '21 13:11 kikearciniegas

@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.

freemanjp avatar Nov 23 '21 20:11 freemanjp