Hi,

Variable are for a host.... You use "localhost" and "staging"

unless the group staging contains only localhost, yes you will have some undefined variable for the different hosts in your staging group

Regards,

JYL


Le 29/02/2020 à 09:48, Dave York a écrit :
I'm confused why I'm getting a 'variable undefined' error with this playbook, anyone have any idea?

- hosts: localhost
connection: local
gather_facts: yes

tasks:
  - name: Generate a temporary random password for template/os customization
set_fact:
randopass: "{{ lookup('password', '/dev/null length=24 chars=ascii_letters') }}" ... I use '{{ randopass }}' somewhere else in this play and its fine... but then I get to this part:
- hosts: staging
vars:
ansible_user: Administrator
ansible_password: '{{ randopass }}'
gather_facts: yes
ERROR:
The field 'password' has an invalid value, which includes an undefined variable. The error was: 'randopass' is undefined
--
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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1a0e91d7-88fe-4d3f-96b4-115de45f29f6%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/1a0e91d7-88fe-4d3f-96b4-115de45f29f6%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b6a93682-90fd-79bf-15d7-d7687000e3d6%40lenhof.eu.org.

Reply via email to