Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An update on the playbook #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ansible-createuser.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# ansible <group/host Name> -m ping -u <userName> --private-key=~/devops.pem
# ansible-playbook -b ansible-createuser.yml -u <userName> --private-key=~/devops.pem
- hosts: all
become: true # I did a change here to become
tasks:
- name: Create Ansible User
user:
name: ansible
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:
Expand All @@ -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:
Expand Down