Ansible is telling me that the HostVars object has no element, but when I
run setup I see the object!
setup:
"ansible_eth1": {
"active": true,
"device": "eth1",
"ipv4": {
"address": "10.209.169.109",
"netmask": "255.255.224.0",
"network": "10.209.160.0"
playbook run:
TASK: [hibbert_db | Create a new database user for hibbert_backend.* with
name hibbert_user and all privileges from local] ***
<10.209.169.109> ESTABLISH CONNECTION FOR USER: mozart on PORT 22 TO
10.209.169.109
fatal: [s-mysql01] => One or more undefined variables:
ansible.runner.HostVars object has no element [0, 's-mysql01']
the task:
- name: Create a new database user for {{ db_name }}.* with name {{ db_user
}} and all privileges from local
tags:
- user
- permissions
mysql_user: host={{ hostvars[item]['ansible_eth1']['ipv4']['address'] }}
name={{ db_user }} password={{ db_password }} priv={{ db_root_name }}.*:ALL
state=present
with_indexed_items: groups['hibbert_db']
sudo: yes
Does anyone have any ideas? Google has been no help.
--
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/6cd2d2fb-fecb-4c2a-8048-64fc054a15b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.