added conjunctive test case for root to task conditional and fixed copy module's valdation string argument

This commit is contained in:
2026-05-30 06:33:25 -04:00
parent ce62e4afa6
commit d364f82c9f

View File

@@ -2,7 +2,7 @@
--- ---
# tasks file for roles/init-vps # tasks file for roles/init-vps
- name: Checking whether administrative login used - name: Checking whether administrative login used
when: ansible_user not in (admins | map(attribute="username") | list) when: ansible_user not in (admins | map(attribute="username") | list) and ansible_user != "root"
ansible.builtin.fail: ansible.builtin.fail:
msg: Must use administrative user for subsequent tasks msg: Must use administrative user for subsequent tasks
- name: Hardening SSH service for the Linode VPS - name: Hardening SSH service for the Linode VPS
@@ -14,5 +14,5 @@
mode: "644" mode: "644"
force: true force: true
backup: true backup: true
validate: "sshd -t %s" validate: 'sshd -t -f %s'
register: ssh_hardened register: ssh_hardened