From d85c92b5ae8cf690f9b0e32d523d952fd3122d31 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Tue, 3 Sep 2024 18:50:45 -0400 Subject: [PATCH] setup the control node v1 --- playbooks/control_node.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/playbooks/control_node.yml b/playbooks/control_node.yml index 4896a0e..c1a808f 100644 --- a/playbooks/control_node.yml +++ b/playbooks/control_node.yml @@ -8,12 +8,30 @@ user: name: ansible generate_ssh_key: true + - name: Create the password for the control user shell: cmd: echo {{ become_password }} | passwd --stdin ansible when: ansible_os_family == 'RedHat' #when: ansible_facts['ansible_os_family'] == 'RedHat' + - name: install chpasswd on debian family os shell: cmd: echo ansible:{{ become_password }} | chpasswd 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 + + +