Auto-fix usage of modules via FQCN

Since ansible-core 2.10 it is recommended to use modules via FQCN
In order to align with recommendation, we perform migration
by applying suggestions made by `ansible-lint --fix=fqcn`

Change-Id: Idc92b63756f9a241ea9be1772ca4156ea85e0881
This commit is contained in:
Dmitriy Rabotyagov 2025-02-13 09:01:50 +01:00
parent d33faaf5c3
commit 82ca2c3b58
5 changed files with 16 additions and 16 deletions

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Restart changed sockets
include_tasks: handlers/socket_restart.yml
ansible.builtin.include_tasks: handlers/socket_restart.yml
listen: systemd socket changed
when:
- "socket_results is changed"
@ -29,7 +29,7 @@
- systemd-service
- name: Restart changed services
include_tasks: handlers/systemd_restart.yml
ansible.builtin.include_tasks: handlers/systemd_restart.yml
vars:
_systemd_service_name: "{{ services_results.item.service_name | replace(' ', '_') }}"
_systemd_service_type: "{{ (services_results.item.timer is defined) | ternary('timer', 'service') }}"

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: "Restarting socket"
systemd:
ansible.builtin.systemd:
name: "{{ socket.socket_name | replace(' ', '_') }}.socket"
state: restarted
when:

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: "Restarting service"
systemd:
ansible.builtin.systemd:
name: "{{ _systemd_service_name }}{{ template_argument }}.{{ _systemd_service_type }}"
state: restarted
loop: "{{ services_results.item.template_arguments | default(['']) }}"

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Create TEMP run dir
file:
ansible.builtin.file:
path: "{{ item.systemd_run_dir | default(systemd_run_dir) }}/{{ item.systemd_slice_name | default(systemd_slice_name) | replace(' ', '_') }}"
state: directory
owner: "{{ item.systemd_user_name | default(systemd_user_name) }}"
@ -32,7 +32,7 @@
- systemd-service
- name: Create TEMP service lock dir
file:
ansible.builtin.file:
path: "{{ item.systemd_lock_dir | default(systemd_lock_dir) }}/{{ item.systemd_slice_name | default(systemd_slice_name) | replace(' ', '_') }}"
state: directory
owner: "{{ item.systemd_user_name | default(systemd_user_name) }}"
@ -50,7 +50,7 @@
- systemd-service
- name: Create service.d overrides dir
file:
ansible.builtin.file:
path: "/etc/systemd/system/{{ item.service_name | replace(' ', '_') }}.service.d"
state: directory
owner: "{{ item.systemd_user_name | default(systemd_user_name) }}"
@ -68,7 +68,7 @@
- systemd-service
- name: Create tmpfiles.d entry
template:
ansible.builtin.template:
src: "systemd-tmpfiles.j2"
dest: "/etc/tmpfiles.d/{{ item.systemd_tempd_prefix | default(systemd_tempd_prefix) }}-{{ item.service_name | replace(' ', '_') }}.conf"
loop: "{{ systemd_services }}"
@ -103,7 +103,7 @@
- systemd-service
- name: Place the systemd override
template:
ansible.builtin.template:
src: "systemd-service-overrides.j2"
dest: "/etc/systemd/system/{{ item.service_name | replace(' ', '_') }}.service.d/override.conf"
loop: "{{ systemd_services | rejectattr('systemd_overrides', 'undefined') }}"
@ -120,7 +120,7 @@
- systemd-service
- name: Place the systemd timer
template:
ansible.builtin.template:
src: "systemd-timer.j2"
dest: "/etc/systemd/system/{{ item.service_name | replace(' ', '_') }}.timer"
mode: "0644"
@ -140,7 +140,7 @@
- systemd-service
- name: Place the systemd socket
template:
ansible.builtin.template:
src: "systemd-socket.j2"
dest: "/etc/systemd/system/{{ item.1.socket_name | replace(' ', '_') }}.socket"
mode: "0644"
@ -161,7 +161,7 @@
- systemd-service
- name: Reload systemd on unit change
systemd:
ansible.builtin.systemd:
daemon_reload: true
when:
- (systemd_services_result is changed) or
@ -170,7 +170,7 @@
(systemd_socket.results | selectattr('changed', 'true') | length > 0)
- name: Including systemd_load tasks
include_tasks: systemd_load.yml
ansible.builtin.include_tasks: systemd_load.yml
vars:
_systemd_service_name: "{{ service.service_name | replace(' ', '_') }}"
loop_label:
@ -187,7 +187,7 @@
- systemd-service
- name: Load socket
systemd:
ansible.builtin.systemd:
name: "{{ item.socket_name | replace(' ', '_') }}.socket"
enabled: "{{ item.enabled | default(systemd_service_enabled) }}"
state: "{{ item.state | default(omit) }}"

View File

@ -17,7 +17,7 @@
# empty string as element. This won't have any effect on the results, but
# we reduce code duplication
- name: "Load service {{ _systemd_service_name }}"
systemd:
ansible.builtin.systemd:
name: "{{ _systemd_service_name }}{{ template_argument }}.service"
enabled: "{{ service.enabled | default(systemd_service_enabled) }}"
state: "{{ (service.timer is defined) | ternary(omit, (service.state | default(omit))) }}"
@ -34,7 +34,7 @@
state: "{{ (service.timer is defined) | ternary('omit', (service.state | default('omit'))) }}"
- name: "Load timer {{ _systemd_service_name }}"
systemd:
ansible.builtin.systemd:
name: "{{ _systemd_service_name }}{{ template_argument }}.timer"
enabled: "{{ service.enabled | default(systemd_service_enabled) }}"
state: "{{ service.timer.state | default(omit) }}"