Improved the prestage_users playbook
This commit is contained in:
parent
e9dc88f33d
commit
66e8d1fc03
@ -9,7 +9,23 @@
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Configure NCA Automation team users for server access
|
||||
- name: Check if OS is RHEL or other
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/redhat-release"
|
||||
register: outcome
|
||||
|
||||
- name: Configure NCA Automation team users for server access (RHEL only)
|
||||
ansible.builtin.user:
|
||||
name: "{{ item.key }}"
|
||||
comment: "Added via Ansible"
|
||||
home: "/home/{{ item.key }}"
|
||||
shell: "/bin/bash"
|
||||
group: "wheel"
|
||||
password: "{{ item.value }}"
|
||||
loop: "{{ lookup('dict', users) }}"
|
||||
when: outcome.stat.exists
|
||||
|
||||
- name: Configure NCA Automation team users for server access (non-RHEL)
|
||||
ansible.builtin.user:
|
||||
name: "{{ item.key }}"
|
||||
comment: "Added via Ansible"
|
||||
@ -18,3 +34,4 @@
|
||||
group: "sudo"
|
||||
password: "{{ item.value }}"
|
||||
loop: "{{ lookup('dict', users) }}"
|
||||
when: not outcome.stat.exists
|
||||
|
||||
Loading…
Reference in New Issue
Block a user