Hi guys, suppose i have this task like the one below, where i want all servers 
from the haproxy group to access a specific mysql database 


- name: ensure murano database user is present
  mysql_user:
    login_host: "{{ mysql_host }}"
    login_password: "{{ mysql_root_password }}"
    login_user: root
    name: myuser
    host: "{{ item }}"
    password: "{{ myuser_mysql_password }}"
    priv: myuserdb*:ALL
    state: present
  ignore_errors: true
  with_items: groups['haproxy']
  run_once: True


so, what i want an advice, is what would be the "Ansible" way to make, not only 
the "names" on the haproxy group to be able to run as an item, but also the 
fqdn of those names, something like (and im totally inventing here, since i 
dont know how to do it, its just to make a point)


- name: ensure murano database user is present
  mysql_user:
    login_host: "{{ mysql_host }}"
    login_password: "{{ mysql_root_password }}"
    login_user: root
    name: myuser
    host: "{{ item }}"
    password: "{{ myuser_mysql_password }}"
    priv: myuserdb*:ALL
    state: present
  ignore_errors: true
  with_items: 

    - groups['haproxy']

    - hostvars.groups.haproxy['ansible_fqdn']
  run_once: True


any help is more than appreciated
best

-- 
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/31d062ce-0274-4e97-be1b-5f8dbbde1bc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to