Hi,
I want to know how I can import user account variables at multiple levels
using loops/arrays and importing them all.
i.e. i have a generic module which has users defined in
roles/common/tasks/main.yml as an array(or loop if more precise):
- name: add admin users on RHEL
user:
name: "{{ item.username }}"
comment: "{{ item.comment }}"
state: present
groups: wheel
shell: /bin/bash
password: "{{ item.password }}"
with_items: "{{ users }}"
when: ansible_facts["os_family"] == "RedHat"
tags: common
and the user attributes are all set as variables and the variables for
these users are being picked up from roles/common/vars/main.yml
I also have user variables defined under group_vars/dev and group_vars/prd
And I also have specific users defined at host level under host_vars/server1
Now the problem is that Ansible is only picking up users from one level,
whilst I want to pick up all the user variables from all levels, i.e.
sysadmins, dev users & specific host users, and add them all in, not just
from the most preferred variable source.
In Puppet this is achieved by using Hiera and "hiera_hash" which allows
variable values to get collectively applied from all hiera levels.
How can the same be achieved with Ansible please?
Regards,
Suhail.
--
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/59e77fe5-808b-47b5-bdb7-0e93fb46b361%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.