Skip to content

clear trailing whitespaces #12

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

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
28 changes: 14 additions & 14 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
---
- name: Add identity key to authorized keys on host
authorized_key:
authorized_key:
user: "{{ ssh_user }}"
key: "{{ lookup('file', ssh_identity_key) }}"
register: add_identity_key
when: ssh_identity_key is defined and ssh_user is defined

- name: Disable empty password login
lineinfile:
dest: "{{ sshd_config }}"
regexp: '^#?PermitEmptyPasswords'
lineinfile:
dest: "{{ sshd_config }}"
regexp: '^#?PermitEmptyPasswords'
line: 'PermitEmptyPasswords no'
notify: restart sshd

- name: Disable remote root login
lineinfile:
dest: "{{ sshd_config }}"
regexp: '^#?PermitRootLogin'
lineinfile:
dest: "{{ sshd_config }}"
regexp: '^#?PermitRootLogin'
line: 'PermitRootLogin no'
notify: restart sshd

- name: Disable password login
lineinfile:
dest: "{{ sshd_config }}"
lineinfile:
dest: "{{ sshd_config }}"
regexp: '^(#\s*)?PasswordAuthentication '
line: 'PasswordAuthentication no'
when:
- add_identity_key is succeeded
when:
- add_identity_key is succeeded
- not add_identity_key is skipped
notify: restart sshd

- name: Enable PAM
lineinfile:
dest: "{{ sshd_config }}"
regexp: '^#?UsePAM'
lineinfile:
dest: "{{ sshd_config }}"
regexp: '^#?UsePAM'
line: 'UsePAM yes'
notify: restart sshd