CHANGE: moves ssh server restart into handlers
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Restart ssh-server Debian
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: sshd
|
||||||
|
state: restarted
|
||||||
|
changed_when: false # It's just a handler, no need to increase 'changed' counter
|
||||||
|
|
||||||
|
- name: Restart ssh-server Ubuntu
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: ssh
|
||||||
|
state: restarted
|
||||||
|
changed_when: false
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
dest: /etc/ssh/sshd_config.d/hardened_sshd.conf
|
dest: /etc/ssh/sshd_config.d/hardened_sshd.conf
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
when: ansible_facts['distribution'] == 'Ubuntu'
|
when: ansible_facts['distribution'] == 'Ubuntu'
|
||||||
|
notify: Restart ssh-server Ubuntu
|
||||||
|
|
||||||
- name: Configure ssh-server daemon
|
- name: Configure ssh-server daemon
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
dest: /etc/ssh/sshd_config.d/hardened_sshd.conf
|
dest: /etc/ssh/sshd_config.d/hardened_sshd.conf
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
when: ansible_facts['distribution'] == 'Debian'
|
when: ansible_facts['distribution'] == 'Debian'
|
||||||
|
notify: Restart ssh-server Debian
|
||||||
|
|
||||||
- name: Configure ssh client
|
- name: Configure ssh client
|
||||||
remote_user: ansible
|
remote_user: ansible
|
||||||
@@ -21,16 +23,16 @@
|
|||||||
dest: /etc/ssh/ssh_config.d/hardened_ssh.conf
|
dest: /etc/ssh/ssh_config.d/hardened_ssh.conf
|
||||||
mode: u=rw,g=r,o=r
|
mode: u=rw,g=r,o=r
|
||||||
|
|
||||||
- name: Restart ssh-server Debian
|
#- name: Restart ssh-server Debian
|
||||||
remote_user: ansible
|
# remote_user: ansible
|
||||||
ansible.builtin.service:
|
# ansible.builtin.service:
|
||||||
name: sshd
|
# name: sshd
|
||||||
state: restarted
|
# state: restarted
|
||||||
when: ansible_facts['distribution'] == 'Debian'
|
# when: ansible_facts['distribution'] == 'Debian'
|
||||||
|
#
|
||||||
- name: Restart ssh-server Ubuntu
|
#- name: Restart ssh-server Ubuntu
|
||||||
remote_user: ansible
|
# remote_user: ansible
|
||||||
ansible.builtin.service:
|
# ansible.builtin.service:
|
||||||
name: ssh
|
# name: ssh
|
||||||
state: restarted
|
# state: restarted
|
||||||
when: ansible_facts['distribution'] == 'Ubuntu'
|
# when: ansible_facts['distribution'] == 'Ubuntu'
|
||||||
|
|||||||
Reference in New Issue
Block a user