From d9e53a73e14905bd992f164f85b351c7e6ee0d5b Mon Sep 17 00:00:00 2001 From: tezeh-ops <121118090+tezeh-ops@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:07:05 -0400 Subject: [PATCH] An update on the playbook Greeting prof. I know during my call we ran this playbook to copy the ssh key and create an ansible user but we had an error. so I was just going through it today and i find out what the problem was i did the corrections and it working good now. So I'm proposing a cross-check and if possible you can merge it. Thank you. Name Samuel Munoh of Class30 --- ansible-createuser.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ansible-createuser.yml b/ansible-createuser.yml index 42e19c5..a044266 100644 --- a/ansible-createuser.yml +++ b/ansible-createuser.yml @@ -1,6 +1,7 @@ # ansible -m ping -u --private-key=~/devops.pem # ansible-playbook -b ansible-createuser.yml -u --private-key=~/devops.pem - hosts: all + become: true # I did a change here to become tasks: - name: Create Ansible User user: @@ -8,7 +9,7 @@ create_home: true shell: /bin/bash comment: "Ansible Management Account" - expires: -1 + expires: null # and the next change was here changing it from -1 to null password: "{{ 'DevOps@2020' | password_hash('sha512','A512') }}" - name: Deploy Local User SSH Key authorized_key: @@ -19,13 +20,13 @@ - name: Setup Sudo Access for Ansible User copy: dest: /etc/sudoers.d/ansible - content: 'ansible ALL=(ALL) NOPASSWD: ALL' + content: 'ansible ALL=(ALL) NOPASSWD: ALL' validate: /usr/sbin/visudo -cf %s - - name: Disable Password Authentication + - name: Enable Password Authentication lineinfile: dest=/etc/ssh/sshd_config regexp='^PasswordAuthentication' - line="PasswordAuthentication no" + line="PasswordAuthentication yes" state=present backup=yes notify: