- domain_definition: - name: server11 cluster: cluster1 port: '8080' - name: server12 cluster: cluster2 port: '8090' - name: server21 cluster: cluster3 port: '9080' - name: server22 cluster: cluster4 port: '9090' - name: server11 - name: server12 - name: server21 - name: server22- set_fact: domain_definition_names_list: "{{ ['name'] | intersect(domain_definition.keys()|list) }}"fatal: [localhost]: FAILED! => { "msg": "The task includes an option with an undefined variable. The error was: 'list object' has no attribute 'keys'...}--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0d4429c3-3a17-4078-ade4-38cd1f48ed83%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0d4429c3-3a17-4078-ade4-38cd1f48ed83%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c928a179-8c43-4375-8c63-0514056d43cf%40googlegroups.com.
On 4/24/20 10:01 AM, jean-christophe manciot wrote:
> Yes, of course: you can define the variable anywhere, including in the hosts file.
> There are 2 differences though:
>
> * the precedence
> <https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable>.
> * the way the variables are defined: the inventory file is not a yaml file (ini format). Refer to this post
> <https://stackoverflow.com/questions/29856738/how-to-define-hash-dict-in-ansible-inventory-file> for how to define
> your dictionary(ies) in the hosts file.
>
The second statement is correct only if you refer to the host file (defaults to /etc/ansible/host). The inventory for
your playbook can be written completely in YAML.
Regards
Racke
> --
> 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