I'm trying to split up a large playbook into roles and it's going pretty well except I'm having trouble with variables not being pulled in from the roles vars or defaults files.
My playbook has this test playbook with a pre_task: --- - hosts: all # vars: # doreboots: true # zadmin_password: Today123zadmin # root_password: Today123 pre_tasks: - debug: msg: "Playbook WILL REBOOT when requested." when: doreboots roles: - setup_ansible_data I've moved the "vars:" section (commented out above) to the main.yml files in both the "vars" and "defaults" directories like this: --- doreboots: true When the playbook is run, I get this error: TASK [debug] ******************************************************************* fatal: [system.example.com]: FAILED! => {"failed": true, "msg": "The conditional check 'doreboots' failed. The error was: error while evaluating conditional (doreboots): 'doreboots' is undefined\n\nThe error appears to have been in '/etc/ansible/roles/sysprep/test.yml': line 10, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n pre_tasks:\n - debug:\n ^ here\n"} Or more human readable: The conditional check 'doreboots' failed. The error was: error while evaluating conditional (doreboots): 'doreboots' is undefined The error appears to have been in '/etc/ansible/roles/sysprep/test.yml': line 10, column 7, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: pre_tasks: - debug: ^ here Thoughts? Thanks! Dan -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e8392e82-92ad-42ee-8ff6-2d4156da8e8e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.