Apply ansible-lint suggestions

This commit is contained in:
Katherina Walshe-Grey 2025-11-11 00:45:12 +00:00
parent 46854e2306
commit d86b2faf8c

View file

@ -4,15 +4,15 @@
- name: Ensure hostname is correct - name: Ensure hostname is correct
ansible.builtin.hostname: ansible.builtin.hostname:
name: '{{ inventory_hostname }}' name: '{{ inventory_hostname }}'
become: yes become: true
- name: Ensure password authentication for SSH is disabled - name: Ensure password authentication for SSH is disabled
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
dest: /etc/ssh/sshd_config dest: /etc/ssh/sshd_config
regexp: '^#?PasswordAuthentication' regexp: '^#?PasswordAuthentication'
line: "PasswordAuthentication no" line: "PasswordAuthentication no"
state: present state: present
backup: yes backup: true
become: yes become: true
notify: notify:
- restart ssh - restart ssh
- name: Update authorized SSH keys for Ansible user - name: Update authorized SSH keys for Ansible user
@ -22,25 +22,30 @@
content: | content: |
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJEmkV9arotms79lJPsLHkdzAac4eu3pYS08ym0sB/on qenya@tohru ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJEmkV9arotms79lJPsLHkdzAac4eu3pYS08ym0sB/on qenya@tohru
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFjBuuxo+w3yED0aPnsNb8S90p/GgBqFEG9K4ETZ5Wkq qenya@kilgharrah ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFjBuuxo+w3yED0aPnsNb8S90p/GgBqFEG9K4ETZ5Wkq qenya@kilgharrah
mode: "0600"
- name: Enable automatic upgrades - name: Enable automatic upgrades
hosts: ovh hosts: ovh
tasks: tasks:
- ansible.builtin.dnf: - name: Install dnf-automatic
ansible.builtin.dnf:
name: dnf-automatic name: dnf-automatic
state: latest state: present
become: yes become: true
- ansible.builtin.copy: - name: Configure dnf-automatic
ansible.builtin.copy:
dest: '/etc/dnf/automatic.conf' dest: '/etc/dnf/automatic.conf'
content: | content: |
[commands] [commands]
apply_updates=True apply_updates=True
reboot=when-needed reboot=when-needed
become: yes mode: "0644"
- ansible.builtin.service: become: true
- name: Enable a timer unit for dnf-automatic
ansible.builtin.service:
name: 'dnf-automatic.timer' name: 'dnf-automatic.timer'
enabled: yes enabled: true
state: started state: started
become: yes become: true
handlers: handlers:
- name: Restart SSH - name: Restart SSH