always use full name of ansible task
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user