From 64771574111d2f8971dab6bce5fc97a9db761d70 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 12 Feb 2025 14:22:36 +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: I331c29a26b98cf813b255c981ba45e1db8561c9f --- handlers/main.yml | 4 ++-- tasks/main.yml | 26 +++++++++++++------------- tasks/placement_db_post_setup.yml | 6 +++--- tasks/placement_db_sync.yml | 2 +- tasks/placement_install.yml | 12 ++++++------ tasks/placement_post_install.yml | 2 +- tasks/placement_pre_install.yml | 6 +++--- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index e78ccf7..12d975c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - name: Stop services - service: + ansible.builtin.service: name: "{{ item.service_name }}" enabled: true state: "stopped" @@ -30,7 +30,7 @@ - "cert installed" - name: Start services - service: + ansible.builtin.service: name: "{{ item.service_name }}" enabled: true state: "started" diff --git a/tasks/main.yml b/tasks/main.yml index 1406e6d..bc3aa2e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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,7 +29,7 @@ - always - name: Fail if service was deployed using a different installation method - fail: + ansible.builtin.fail: msg: "Switching installation methods for OpenStack services is not supported" when: - ansible_local is defined @@ -39,12 +39,12 @@ - ansible_local.openstack_ansible.placement.install_method != placement_install_method - name: Gather variables for installation method - include_vars: "{{ placement_install_method }}_install.yml" + ansible.builtin.include_vars: "{{ placement_install_method }}_install.yml" tags: - always - name: Including osa.db_setup role - include_role: + ansible.builtin.include_role: name: openstack.osa.db_setup apply: tags: @@ -66,17 +66,17 @@ - always - name: Importing placement_pre_install tasks - import_tasks: placement_pre_install.yml + ansible.builtin.import_tasks: placement_pre_install.yml tags: - placement-install - name: Importing placement_install tasks - import_tasks: placement_install.yml + ansible.builtin.import_tasks: placement_install.yml tags: - placement-install - name: Create and install SSL certificates - include_role: + ansible.builtin.include_role: name: pki tasks_from: main_certs.yml apply: @@ -96,19 +96,19 @@ - always - name: Importing placement_post_install tasks - import_tasks: placement_post_install.yml + ansible.builtin.import_tasks: placement_post_install.yml tags: - placement-config - post-install - name: Importing placement_db_sync tasks - import_tasks: placement_db_sync.yml + ansible.builtin.import_tasks: placement_db_sync.yml when: _placement_is_first_play_host tags: - placement-config - name: Import uwsgi role - import_role: + ansible.builtin.import_role: name: uwsgi vars: uwsgi_services: "{{ uwsgi_placement_services }}" @@ -118,7 +118,7 @@ - uwsgi - name: Including osa.service_setup role - include_role: + ansible.builtin.include_role: name: openstack.osa.service_setup apply: tags: @@ -154,10 +154,10 @@ - always - name: Flush handlers - meta: flush_handlers + ansible.builtin.meta: flush_handlers - name: Including placement_db_post_setup tasks - include_tasks: placement_db_post_setup.yml + ansible.builtin.include_tasks: placement_db_post_setup.yml args: apply: tags: diff --git a/tasks/placement_db_post_setup.yml b/tasks/placement_db_post_setup.yml index 2e56c09..ff57436 100644 --- a/tasks/placement_db_post_setup.yml +++ b/tasks/placement_db_post_setup.yml @@ -14,12 +14,12 @@ # limitations under the License. - name: Refresh local facts - setup: + ansible.builtin.setup: filter: ansible_local gather_subset: "!all" - name: Perform a Placement DB online migrations - command: "{{ placement_bin }}/placement-manage db online_data_migrations" + ansible.builtin.command: "{{ placement_bin }}/placement-manage db online_data_migrations" become: true become_user: "{{ placement_system_user_name }}" changed_when: false @@ -33,7 +33,7 @@ - name: Disable the online migrations requirement delegate_to: "{{ item }}" - ini_file: + community.general.ini_file: dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: placement option: need_online_data_migrations diff --git a/tasks/placement_db_sync.yml b/tasks/placement_db_sync.yml index 58e4db6..a424ff4 100644 --- a/tasks/placement_db_sync.yml +++ b/tasks/placement_db_sync.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Perform a Placement DB sync - command: "{{ placement_bin }}/placement-manage db sync" + ansible.builtin.command: "{{ placement_bin }}/placement-manage db sync" become: true become_user: "{{ placement_system_user_name }}" changed_when: false diff --git a/tasks/placement_install.yml b/tasks/placement_install.yml index 9fca4d9..6f15047 100644 --- a/tasks/placement_install.yml +++ b/tasks/placement_install.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Record the installation method - ini_file: + community.general.ini_file: dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: "placement" option: "install_method" @@ -22,12 +22,12 @@ mode: "0644" - name: Refresh local facts to ensure the placement section is present - setup: + ansible.builtin.setup: filter: ansible_local gather_subset: "!all" - name: Install distro packages - package: + ansible.builtin.package: name: "{{ placement_package_list }}" state: "{{ placement_package_state }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}" @@ -38,7 +38,7 @@ delay: 2 - name: Install the python venv - import_role: + ansible.builtin.import_role: name: "python_venv_build" vars: venv_python_executable: "{{ placement_venv_python_executable }}" @@ -58,7 +58,7 @@ when: placement_install_method == 'source' - name: Record the need for a service restart - ini_file: + community.general.ini_file: dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: "placement" option: "need_online_data_migrations" @@ -68,7 +68,7 @@ ('need_online_data_migrations' not in ansible_local['openstack_ansible']['placement']) - name: Run the systemd service role - include_role: + ansible.builtin.include_role: name: systemd_service vars: systemd_user_name: "{{ placement_system_user_name }}" diff --git a/tasks/placement_post_install.yml b/tasks/placement_post_install.yml index 91b6f7e..963e3f2 100644 --- a/tasks/placement_post_install.yml +++ b/tasks/placement_post_install.yml @@ -42,7 +42,7 @@ - placement-policy-override - name: Remove legacy policy.yaml file - file: + ansible.builtin.file: path: "/etc/placement/policy.yaml" state: absent when: diff --git a/tasks/placement_pre_install.yml b/tasks/placement_pre_install.yml index 4807b8d..7fe3ab7 100644 --- a/tasks/placement_pre_install.yml +++ b/tasks/placement_pre_install.yml @@ -14,14 +14,14 @@ # limitations under the License. - name: Create the system group - group: + ansible.builtin.group: name: "{{ placement_system_group_name }}" gid: "{{ placement_system_group_gid | default(omit) }}" state: "present" system: "yes" - name: Create the placement system user - user: + ansible.builtin.user: name: "{{ placement_system_user_name }}" uid: "{{ placement_system_user_uid | default(omit) }}" group: "{{ placement_system_group_name }}" @@ -32,7 +32,7 @@ home: "{{ placement_system_user_home }}" - name: Create placement dir - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory owner: "{{ item.owner | default(placement_system_user_name) }}"