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: I490bcfa824a5516271b188e1383d02b5bd578171
This commit is contained in:
Dmitriy Rabotyagov 2025-02-13 09:06:04 +01:00
parent be093f9f58
commit 1d919bb350
4 changed files with 21 additions and 21 deletions

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Delete mount file(s)
file:
ansible.builtin.file:
path: "/etc/systemd/system/{{ item.where.strip('/') | replace('/', '-') }}.{{ item.type == 'swap' | ternary('swap', 'mount') }}"
state: "absent"
when:
@ -23,7 +23,7 @@
listen: Remove mount
- name: Delete mount target(s)
file:
ansible.builtin.file:
path: "{{ item.where }}"
state: "absent"
when:
@ -32,7 +32,7 @@
listen: Remove mount
- name: Reload systemd daemon
systemd:
ansible.builtin.systemd:
daemon_reload: true
no_block: true
listen: Remove mount

View File

@ -14,7 +14,7 @@
# limitations under the License.
- name: Gather variables for each operating system
include_vars: "{{ lookup('first_found', params) }}"
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
@ -29,8 +29,8 @@
- always
- name: Including systemd_install tasks
include_tasks: systemd_install.yml
ansible.builtin.include_tasks: systemd_install.yml
- name: Including systemd_mounts tasks
include_tasks: systemd_mounts.yml
ansible.builtin.include_tasks: systemd_mounts.yml
with_items: "{{ systemd_mounts }}"

View File

@ -19,7 +19,7 @@
- ansible_facts['os_family'] | lower == 'redhat'
block:
- name: Download EPEL gpg keys
get_url:
ansible.builtin.get_url:
url: "{{ systemd_centos_epel_key }}"
dest: /etc/pki/rpm-gpg
mode: "0640"
@ -29,12 +29,12 @@
delay: 2
- name: Install EPEL gpg keys
rpm_key:
ansible.builtin.rpm_key:
key: "/etc/pki/rpm-gpg/{{ systemd_centos_epel_key.split('/')[-1] }}"
state: present
- name: Install the EPEL repository
yum_repository:
ansible.builtin.yum_repository:
name: epel-systemd_mounts
baseurl: "{{ systemd_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}"
description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch"
@ -48,7 +48,7 @@
delay: 2
- name: Install required distro packages for mounts
package:
ansible.builtin.package:
name: "{{ systemd_mount_packages }}"
state: present
@ -56,7 +56,7 @@
# parameter, the when: condition must be able to be resolved inside the
# systemd_service role where role vars from systemd_mount are not in scope
- name: Make boolean flag for setting up glusterfs
set_fact:
ansible.builtin.set_fact:
_configure_glusterfs: "{{ 'glusterfs' in systemd_mount_types }}"
- name: Configure fuse for glusterfs
@ -64,7 +64,7 @@
- _configure_glusterfs
block:
- name: Configure systemd-tmpfiles to create /dev/fuse at boot
copy:
ansible.builtin.copy:
content: "c /dev/fuse 0600 - - - 10:229"
dest: "/etc/tmpfiles.d/openstack-ansible-systemd_mount-glusterfs-client.conf"
mode: "0644"
@ -72,7 +72,7 @@
- name: Apply systemctl overrides
when: ansible_facts['pkg_mgr'] == 'dnf'
include_role:
ansible.builtin.include_role:
name: systemd_service
vars:
systemd_services:
@ -85,7 +85,7 @@
ConditionCapability: ""
- name: Restart systemd-tmpfiles-setup-dev
service:
ansible.builtin.service:
name: "systemd-tmpfiles-setup-dev"
state: restarted
when:

View File

@ -14,18 +14,18 @@
# limitations under the License.
- name: Set mount facts
set_fact:
ansible.builtin.set_fact:
systemd_mount_suffix: "{{ (item.type == 'swap') | ternary('swap', 'mount') }}"
systemd_mount_item: "{{ item.where | default(item.what) }}"
- name: Escape mount service file name
command: systemd-escape -p --suffix="{{ systemd_mount_suffix }}" "{{ systemd_mount_item }}"
ansible.builtin.command: systemd-escape -p --suffix="{{ systemd_mount_suffix }}" "{{ systemd_mount_item }}"
changed_when: false
register: mount_service_name
# NOTE(noonedeadpunk): with s3fs IO error would raise on attempt to change permissions.
- name: Create mount target(s)
file:
ansible.builtin.file:
path: "{{ item.where }}"
state: directory
owner: "{{ item.owner | default(omit) }}"
@ -40,7 +40,7 @@
- systemd-mount
- name: Place mount credentials when required
copy:
ansible.builtin.copy:
dest: "/etc/passwd-{{ mount_service_name.stdout }}"
content: "{{ item.credentials }}"
owner: "root"
@ -65,7 +65,7 @@
- systemd-mount
- name: Load or Unload mount(s)
systemd:
ansible.builtin.systemd:
daemon_reload: true
name: "{{ mount_service_name.stdout }}"
enabled: "{{ item.enabled | default(true) }}"
@ -97,12 +97,12 @@
- skip_ansible_lint
rescue:
- name: Set the state of the mount (fallback)
systemd:
ansible.builtin.systemd:
name: "{{ mount_service_name.stdout }}"
state: "{{ item.state }}"
- name: Unload mount(s)
systemd:
ansible.builtin.systemd:
daemon_reload: true
name: "{{ mount_service_name.stdout }}"
enabled: false