Compare commits

..

No commits in common. "b79bd4d2d75a15c24cdb87bf9d074e55b1af4f4f" and "a550c49dec3cd6840db6db20fd6fbb0a8d4669d2" have entirely different histories.

3 changed files with 3 additions and 44 deletions

View file

@ -18,10 +18,6 @@ ensure_ansible_version: 2.10.3
enable_sudo: yes enable_sudo: yes
# Allow passwordless sudo (applied to group wheel) # Allow passwordless sudo (applied to group wheel)
enable_passwordless_sudo: yes enable_passwordless_sudo: yes
# Allow root to connect through SSH
enable_ssh_for_root: yes
# Allow root to connect only using public key authentication, no password
enable_ssh_for_root_prohibit_password: no
# Skip provisioning of the firewall # Skip provisioning of the firewall
skip_firewall: no skip_firewall: no
authorized_keys_are_exclusive: false # Be careful, this will delete non-Ansible-managed authorized keys from the target! authorized_keys_are_exclusive: false # Be careful, this will delete non-Ansible-managed authorized keys from the target!

View file

@ -1,7 +1,2 @@
--- ---
# handlers file for common # handlers file for common
- name: Restart SSH
ansible.builtin.service:
name: ssh
state: restarted
become: true

View file

@ -72,38 +72,6 @@
files: files:
- /etc/sudoers - /etc/sudoers
- /usr/local/etc/sudoers # e.g. FreeBSD - /usr/local/etc/sudoers # e.g. FreeBSD
- name: 'Disable SSH for root'
lineinfile:
dest: "/etc/ssh/sshd_config"
state: present
regexp: '^#?\s*PermitRootLogin'
line: 'PermitRootLogin No'
notify: Restart SSH
when:
- enable_ssh_for_root | bool == false
- name: 'Enable SSH for root through password or key'
lineinfile:
dest: "/etc/ssh/sshd_config"
state: present
regexp: '^#?\s*PermitRootLogin'
line: 'PermitRootLogin Yes'
notify: Restart SSH
when:
- enable_ssh_for_root | bool == true
- enable_ssh_for_root_prohibit_password | bool == false
- name: 'Enable SSH for root through key only'
lineinfile:
dest: "/etc/ssh/sshd_config"
state: present
regexp: '^#?\s*PermitRootLogin'
line: 'PermitRootLogin prohibit-password'
notify: Restart SSH
when:
- enable_ssh_for_root | bool == true
- enable_ssh_for_root_prohibit_password | bool == true
when: when:
- enable_sudo - enable_sudo
- enable_passwordless_sudo - enable_passwordless_sudo