Hey Dan,
It seems you have two spaces in front of the variable, I'm not sure if that
poses a problem, but maybe try putting it like this:
---
doreboots: true
...
On Thursday, March 9, 2017 at 9:01:10 AM UTC+1, Dan Linder wrote:
>
> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/65979a8f-ed13-4cb2-bdd2-ae5b33d6586f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.