Rename handlers to start with sshd_ prefix

The documentation says there is only one global scope for handlers:

> There is only one global scope for handlers (handler names and listen topics)
> regardless of where the handlers are defined. This also includes handlers
> defined in roles.

So following the naming convention as we do in all the other variables
sounds like a good idea.

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Jakub Jelen 2024-12-16 13:47:06 +01:00 committed by Jakub Jelen
parent fcb09ccaa9
commit 6e3257736e
5 changed files with 11 additions and 11 deletions

View file

@ -10,7 +10,7 @@
- ansible_connection != 'chroot' - ansible_connection != 'chroot'
- ansible_facts['os_family'] != 'AIX' - ansible_facts['os_family'] != 'AIX'
- ansible_facts['os_family'] != 'OpenWrt' - ansible_facts['os_family'] != 'OpenWrt'
listen: Reload_sshd listen: sshd_reload
- name: Restart the SSH service - name: Restart the SSH service
ansible.builtin.service: ansible.builtin.service:
@ -22,7 +22,7 @@
- ansible_connection != 'chroot' - ansible_connection != 'chroot'
- ansible_facts['os_family'] != 'AIX' - ansible_facts['os_family'] != 'AIX'
- ansible_facts['os_family'] != 'OpenWrt' - ansible_facts['os_family'] != 'OpenWrt'
listen: Restart_sshd listen: sshd_restart
# sshd on AIX cannot be 'reloaded', it must be Stopped+Started. # sshd on AIX cannot be 'reloaded', it must be Stopped+Started.
# It's dangerous to do this in two tasks.. you're stopping SSH and then trying to SSH back in to start it. # It's dangerous to do this in two tasks.. you're stopping SSH and then trying to SSH back in to start it.
@ -37,7 +37,7 @@
stopsrc -s sshd stopsrc -s sshd
until $(lssrc -s sshd | grep -q inoperative); do sleep 1; done until $(lssrc -s sshd | grep -q inoperative); do sleep 1; done
startsrc -s sshd startsrc -s sshd
listen: Reload_sshd listen: sshd_reload
changed_when: false changed_when: false
when: when:
- sshd_allow_reload|bool - sshd_allow_reload|bool
@ -51,4 +51,4 @@
when: when:
- sshd_allow_reload|bool - sshd_allow_reload|bool
- ansible_facts['os_family'] == 'OpenWrt' - ansible_facts['os_family'] == 'OpenWrt'
listen: Reload_sshd listen: sshd_reload

View file

@ -25,7 +25,7 @@
when: when:
- sshd_sysconfig | bool - sshd_sysconfig | bool
- __sshd_sysconfig_supports_use_strong_rng or __sshd_sysconfig_supports_crypto_policy - __sshd_sysconfig_supports_use_strong_rng or __sshd_sysconfig_supports_crypto_policy
notify: Restart_sshd notify: sshd_restart
- name: Check FIPS mode - name: Check FIPS mode
ansible.builtin.include_tasks: check_fips.yml ansible.builtin.include_tasks: check_fips.yml

View file

@ -24,7 +24,7 @@
{{ sshd_binary | quote }} -t -f %s {{ sshd_binary | quote }} -t -f %s
{% endif %} {% endif %}
backup: "{{ sshd_backup }}" backup: "{{ sshd_backup }}"
notify: Reload_sshd notify: sshd_reload
- name: Make sure the include path is present in the main sshd_config - name: Make sure the include path is present in the main sshd_config
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
@ -43,7 +43,7 @@
{{ sshd_binary | quote }} -t -f %s {{ sshd_binary | quote }} -t -f %s
{% endif %} {% endif %}
backup: "{{ sshd_backup }}" backup: "{{ sshd_backup }}"
notify: Reload_sshd notify: sshd_reload
when: when:
- sshd_main_config_file is not none - sshd_main_config_file is not none
- sshd_config_file | dirname == sshd_main_config_file ~ '.d' - sshd_config_file | dirname == sshd_main_config_file ~ '.d'

View file

@ -21,4 +21,4 @@
{{ sshd_binary | quote }} -t -f %s {{ sshd_binary | quote }} -t -f %s
{% endif %} {% endif %}
backup: "{{ sshd_backup }}" backup: "{{ sshd_backup }}"
notify: Reload_sshd notify: sshd_reload

View file

@ -12,7 +12,7 @@
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
notify: Reload_sshd notify: sshd_reload
- name: Install instanced service unit file - name: Install instanced service unit file
ansible.builtin.template: ansible.builtin.template:
@ -21,7 +21,7 @@
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
notify: Reload_sshd notify: sshd_reload
when: when:
- __sshd_socket_accept | bool - __sshd_socket_accept | bool
@ -32,7 +32,7 @@
owner: root owner: root
group: root group: root
mode: "0644" mode: "0644"
notify: Reload_sshd notify: sshd_reload
- name: Service enabled and running - name: Service enabled and running
ansible.builtin.service: ansible.builtin.service: