setup the control node v1

This commit is contained in:
Ibrahim Mkusa 2024-09-03 18:50:45 -04:00
parent 4a24e7cdaf
commit d85c92b5ae

View File

@ -8,12 +8,30 @@
user: user:
name: ansible name: ansible
generate_ssh_key: true generate_ssh_key: true
- name: Create the password for the control user - name: Create the password for the control user
shell: shell:
cmd: echo {{ become_password }} | passwd --stdin ansible cmd: echo {{ become_password }} | passwd --stdin ansible
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
#when: ansible_facts['ansible_os_family'] == 'RedHat' #when: ansible_facts['ansible_os_family'] == 'RedHat'
- name: install chpasswd on debian family os - name: install chpasswd on debian family os
shell: shell:
cmd: echo ansible:{{ become_password }} | chpasswd cmd: echo ansible:{{ become_password }} | chpasswd
when: ansible_os_family == 'Debian' when: ansible_os_family == 'Debian'
- name: give the user elevated priviledges
copy:
content: "ansible ALL=(ALL) NOPASSWD: ALL"
dest: /etc/sudoers.d/ansible
- name: add the user to the specified groups
user:
name: ansible
append: true
groups:
- kvm
- libvirt