always use full name of ansible task

This commit is contained in:
2023-03-05 19:00:38 +01:00
parent d83c801db1
commit 95e3332f80
19 changed files with 80 additions and 80 deletions

View File

@ -13,13 +13,13 @@
shell: "/sbin/nologin"
- name: Undefine AllowUsers
lineinfile:
ansible.builtin.lineinfile:
state: absent
path: /etc/ssh/sshd_config
line: "AllowUsers tormakris ansible service-user"
- name: Check if AllowUsers is defined
lineinfile:
ansible.builtin.lineinfile:
state: absent
path: /etc/ssh/sshd_config
regexp: "^AllowUsers"
@ -28,24 +28,24 @@
register: checkallowusers
- name: Define AllowUsers if undefined
lineinfile:
ansible.builtin.lineinfile:
state: present
path: /etc/ssh/sshd_config
line: "AllowUsers tormakris ansible backup"
when: checkallowusers.found == 0
- name: "Restart sshd"
service:
ansible.builtin.service:
name: sshd
state: restarted
- name: Create .ssh directory of backup user
file:
ansible.builtin.file:
path: /home/backup/.ssh
state: directory
- name: Copy authorized_keys
copy:
ansible.builtin.copy:
src: authorized_keys
dest: /home/backup/.ssh/authorized_keys
mode: 0600
@ -53,7 +53,7 @@
group: backup
- name: Copy ssh config
copy:
ansible.builtin.copy:
src: ssh_config
dest: /home/backup/.ssh/config
mode: 0600