hi all,
i am trying to be DRY, and wondering if i can somehow register all of the
hosts that are part of inventory group .. for example:
#inventory
[db_slave]
host1
host2
#playbook
- name: create slave user for each slave host
mysql_user:
name=slave
password=foo
host={{ item }}
state=present
with_items:
- #need help here
- #somehow get list of hosts from group db_slave
yes, i did see this example online:
{% for host in groups['db_slave'] %}
{{ hostvars[host]['hostname'] }}
{% endfor %}
and i even tried to put that into my roles "vars" directory .. but just
kept getting syntax errors which makes sense ..
# slave hosts
mysql_slave_hosts:
{% for host in groups['db_slave'] %}
- {{ hostvars[host]['hostname'] }}
{% endfor %}
any thoughts ??
thanks as always,
greg
--
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].
For more options, visit https://groups.google.com/groups/opt_out.