From 793395ae1863357571bb584257a83f7145258f44 Mon Sep 17 00:00:00 2001
From: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
Date: Wed, 12 Feb 2025 15:18:17 +0100
Subject: [PATCH] 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: I4d3b487b43be7d1d27ae8379d05eda932c43c185
---
 handlers/main.yml               |  2 +-
 tasks/main.yml                  | 32 ++++++++++++++++----------------
 tasks/trove_db_sync.yml         |  2 +-
 tasks/trove_post_install.yml    |  6 +++---
 tasks/trove_pre_install.yml     |  6 +++---
 tasks/trove_service_network.yml |  4 ++--
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/handlers/main.yml b/handlers/main.yml
index 0f34f11..24d8c0d 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -17,7 +17,7 @@
 # (c) 2016 Paul Stevens <paul.stevens@is.co.za>
 
 - name: Restart Trove services
-  systemd:
+  ansible.builtin.systemd:
     name: "{{ item.service_name }}"
     enabled: true
     state: "restarted"
diff --git a/tasks/main.yml b/tasks/main.yml
index 97004c4..787c18a 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -17,7 +17,7 @@
 # (c) 2016 Paul Stevens <paul.stevens@is.co.za>
 
 - name: Gather variables for each operating system
-  include_vars: "{{ lookup('first_found', params) }}"
+  ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
   vars:
     params:
       files:
@@ -33,7 +33,7 @@
     - always
 
 - name: Fail if our required secrets are not present
-  fail:
+  ansible.builtin.fail:
     msg: "Please set the {{ item }} variable prior to applying this role."
   when: (item is undefined) or (item is none)
   with_items: "{{ trove_required_secrets }}"
@@ -41,7 +41,7 @@
     - always
 
 - name: Including osa.db_setup role
-  include_role:
+  ansible.builtin.include_role:
     name: openstack.osa.db_setup
     apply:
       tags:
@@ -63,7 +63,7 @@
     - always
 
 - name: Including osa.mq_setup role
-  include_role:
+  ansible.builtin.include_role:
     name: openstack.osa.mq_setup
     apply:
       tags:
@@ -89,7 +89,7 @@
     - always
 
 - name: Including osa.mq_setup role
-  include_role:
+  ansible.builtin.include_role:
     name: openstack.osa.mq_setup
     apply:
       tags:
@@ -117,12 +117,12 @@
     - always
 
 - name: Importing trove_pre_install tasks
-  import_tasks: trove_pre_install.yml
+  ansible.builtin.import_tasks: trove_pre_install.yml
   tags:
     - trove-install
 
 - name: Create and install SSL certificates
-  include_role:
+  ansible.builtin.include_role:
     name: pki
     tasks_from: main_certs.yml
     apply:
@@ -142,7 +142,7 @@
     - always
 
 - name: Install the python venv
-  import_role:
+  ansible.builtin.import_role:
     name: "python_venv_build"
   vars:
     venv_python_executable: "{{ trove_venv_python_executable }}"
@@ -159,7 +159,7 @@
     - trove-install
 
 - name: Including trove_resources tasks
-  include_tasks: trove_resources.yml
+  ansible.builtin.include_tasks: trove_resources.yml
   when:
     - trove_service_net_setup or trove_guestagent_images
     - _trove_is_first_play_host
@@ -171,20 +171,20 @@
     - trove-install
 
 - name: Importing trove_service_network tasks
-  import_tasks: trove_service_network.yml
+  ansible.builtin.import_tasks: trove_service_network.yml
   tags:
     - trove-install
     - trove-config
 
 - name: Importing trove_post_install tasks
-  import_tasks: trove_post_install.yml
+  ansible.builtin.import_tasks: trove_post_install.yml
   tags:
     - trove-install
     - trove-config
     - post-install
 
 - name: Run the systemd service role
-  include_role:
+  ansible.builtin.include_role:
     name: systemd_service
   vars:
     systemd_user_name: "{{ trove_system_user_name }}"
@@ -211,7 +211,7 @@
     - systemd-service
 
 - name: Import uwsgi role
-  import_role:
+  ansible.builtin.import_role:
     name: uwsgi
   vars:
     uwsgi_services: "{{ uwsgi_trove_services }}"
@@ -222,7 +222,7 @@
     - uwsgi
 
 - name: Including osa.service_setup role
-  include_role:
+  ansible.builtin.include_role:
     name: openstack.osa.service_setup
     apply:
       tags:
@@ -260,10 +260,10 @@
     - always
 
 - name: Importing trove_db_sync tasks
-  import_tasks: trove_db_sync.yml
+  ansible.builtin.import_tasks: trove_db_sync.yml
   when: _trove_conductor_is_first_play_host
   tags:
     - trove-install
 
 - name: Flush handlers
-  meta: flush_handlers
+  ansible.builtin.meta: flush_handlers
diff --git a/tasks/trove_db_sync.yml b/tasks/trove_db_sync.yml
index f023466..6f6f34f 100644
--- a/tasks/trove_db_sync.yml
+++ b/tasks/trove_db_sync.yml
@@ -17,7 +17,7 @@
 # (c) 2016 Paul Stevens <paul.stevens@is.co.za>
 
 - name: Perform a trove DB sync
-  command: "{{ trove_bin }}/trove-manage db_sync"
+  ansible.builtin.command: "{{ trove_bin }}/trove-manage db_sync"
   become: true
   become_user: "{{ trove_system_user_name }}"
   changed_when: false
diff --git a/tasks/trove_post_install.yml b/tasks/trove_post_install.yml
index 7c12147..f5b0732 100644
--- a/tasks/trove_post_install.yml
+++ b/tasks/trove_post_install.yml
@@ -17,7 +17,7 @@
 # (c) 2016 Paul Stevens <paul.stevens@is.co.za>
 
 - name: Gathering network facts for interface {{ trove_provider_net_name }}
-  setup:
+  ansible.builtin.setup:
     gather_subset: "!all,network"
     filter: "{{ trove_address_gather_filter | default('ansible_' ~ trove_provider_net_iface | replace('-', '_')) }}"
   delegate_to: "{{ item }}"
@@ -65,7 +65,7 @@
     - trove-policy-override
 
 - name: Remove legacy policy.yaml file
-  file:
+  ansible.builtin.file:
     path: "/etc/trove/policy.yaml"
     state: absent
   when:
@@ -74,7 +74,7 @@
     - trove-policy-override
 
 - name: Drop trove wsgi binary
-  template:
+  ansible.builtin.template:
     src: wsgi.py.j2
     dest: "{{ trove_bin }}/trove-api-wsgi"
     owner: "{{ trove_system_user_name }}"
diff --git a/tasks/trove_pre_install.yml b/tasks/trove_pre_install.yml
index af4ed59..71da3bd 100644
--- a/tasks/trove_pre_install.yml
+++ b/tasks/trove_pre_install.yml
@@ -16,13 +16,13 @@
 # (c) 2016 Donovan Francesco <donovan.francesco@is.co.za>
 # (c) 2016 Paul Stevens <paul.stevens@is.co.za>
 - name: Create the system group
-  group:
+  ansible.builtin.group:
     name: "{{ trove_system_group_name }}"
     state: "present"
     system: "yes"
 
 - name: Create the trove system user
-  user:
+  ansible.builtin.user:
     name: "{{ trove_system_user_name }}"
     group: "{{ trove_system_group_name }}"
     comment: "{{ trove_system_user_comment }}"
@@ -32,7 +32,7 @@
     home: "{{ trove_system_user_home }}"
 
 - name: Create trove dirs
-  file:
+  ansible.builtin.file:
     path: "{{ item.path }}"
     state: directory
     owner: "{{ item.owner | default(trove_system_user_name) }}"
diff --git a/tasks/trove_service_network.yml b/tasks/trove_service_network.yml
index 6016f6a..0220e9f 100644
--- a/tasks/trove_service_network.yml
+++ b/tasks/trove_service_network.yml
@@ -29,7 +29,7 @@
       run_once: true
 
     - name: Fail if trove service network is not available
-      fail:
+      ansible.builtin.fail:
         msg: >
           "Trove service network {{ trove_service_net_name }} is not available. "
           "For Trove to operate properly it needs a network created to allocate "
@@ -39,6 +39,6 @@
         - _get_trove_service_net.networks is not defined or _get_trove_service_net.networks | length == 0
 
     - name: Save trove service net id
-      set_fact:
+      ansible.builtin.set_fact:
         trove_service_net_id: "{{ _get_trove_service_net.networks[0].id }}"
       run_once: true