From 9ad3fd768159210a9526bc34ddeb065f3f945690 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 12 Feb 2025 12:45:21 +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: Ib3dafb476992c0c75ae1b3cc84024463641a0775 --- handlers/main.yml | 10 ++++---- tasks/ironic_conductor_post_install.yml | 34 ++++++++++++------------- tasks/ironic_db_setup.yml | 4 +-- tasks/ironic_deploy_image.yml | 4 +-- tasks/ironic_inspector_post_install.yml | 20 +++++++-------- tasks/ironic_inspector_pre_install.yml | 6 ++--- tasks/ironic_post_install.yml | 16 ++++++------ tasks/ironic_pre_install.yml | 6 ++--- tasks/main.yml | 34 ++++++++++++------------- 9 files changed, 67 insertions(+), 67 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 1f775798..3335144c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Restart ironic services - service: + ansible.builtin.service: name: "{{ item.service_name }}" state: restarted enabled: true @@ -26,7 +26,7 @@ - "cert installed" - name: Restart tftpd - service: + ansible.builtin.service: name: "{{ ironic_tftpd_service_name }}" state: restarted enabled: true @@ -34,19 +34,19 @@ failed_when: false - name: Restart isc-dhcp-server - service: + ansible.builtin.service: name: "isc-dhcp-server" state: restarted failed_when: false - name: Restart ironic-inspector-dnsmasq - service: + ansible.builtin.service: name: "ironic-inspector-dnsmasq" state: restarted failed_when: false - name: Restart web server - service: + ansible.builtin.service: name: "nginx" enabled: true state: restarted diff --git a/tasks/ironic_conductor_post_install.yml b/tasks/ironic_conductor_post_install.yml index 13db4ffa..4f71d471 100644 --- a/tasks/ironic_conductor_post_install.yml +++ b/tasks/ironic_conductor_post_install.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Copy in sample dhcpd.conf file - copy: + ansible.builtin.copy: src: "dhcpd.conf" dest: "/etc/dhcp/" mode: "0644" @@ -23,7 +23,7 @@ - Restart isc-dhcp-server - name: Create tftpboot path - file: + ansible.builtin.file: path: "{{ ironic_tftpd_root }}" state: directory owner: "{{ ironic_system_user_name }}" @@ -31,7 +31,7 @@ mode: "0755" - name: Copy in tftpd-hpa config file - template: + ansible.builtin.template: src: "tftpd-hpa.j2" dest: "/etc/default/tftpd-hpa" mode: "0644" @@ -41,7 +41,7 @@ - Restart tftpd - name: Copy in tftpd map file - template: + ansible.builtin.template: src: "map-file" dest: "{{ ironic_tftpd_root }}/map-file" mode: "0644" @@ -49,7 +49,7 @@ - Restart tftpd - name: Copy library modules into tftpboot - copy: + ansible.builtin.copy: src: "{{ item }}" dest: "{{ ironic_tftpd_root }}/" remote_src: true @@ -57,13 +57,13 @@ with_items: "{{ ironic_library_modules_paths }}" - name: Ensure grub directory exists in tftpboot - file: + ansible.builtin.file: path: "{{ ironic_grub_dir }}" state: directory recurse: true - name: Copy PXE grub config into tftpboot - copy: + ansible.builtin.copy: src: "grub.conf" dest: "{{ ironic_grub_dir }}/grub.cfg" mode: "0644" @@ -71,7 +71,7 @@ group: "ironic" - name: Copy content into tftpboot (files) - copy: + ansible.builtin.copy: src: "{{ item.path }}" dest: "{{ ironic_tftpd_root }}/{{ item.name }}" remote_src: true @@ -79,20 +79,20 @@ with_items: "{{ (ironic_uefi_modules + ironic_tftp_extra_content) | selectattr('path', 'defined') | list }}" - name: Copy content into tftpboot (urls) - get_url: + ansible.builtin.get_url: url: "{{ item.url }}" dest: "{{ ironic_tftpd_root }}/{{ item.name }}" mode: "0644" with_items: "{{ (ironic_uefi_modules + ironic_tftp_extra_content) | selectattr('url', 'defined') | list }}" - name: Start up tftp - service: + ansible.builtin.service: name: "{{ ironic_tftpd_service_name }}" state: started enabled: true - name: Disable default nginx configuration - file: + ansible.builtin.file: path: /etc/nginx/sites-enabled/default state: absent when: "ironic_ipxe_enabled | bool" @@ -100,7 +100,7 @@ - Restart web server - name: Remove default nginx config - file: + ansible.builtin.file: path: /etc/nginx/conf.d/default.conf state: absent when: "ironic_ipxe_enabled | bool" @@ -108,7 +108,7 @@ - Restart web server - name: Ensure nginx configuration directories exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: "0755" @@ -117,7 +117,7 @@ - "/etc/nginx/{{ ironic_nginx_conf_path }}" - name: Write alternate nginx.conf for rh like systems - template: + ansible.builtin.template: src: nginx-nodefault.conf.j2 dest: "/etc/nginx/nginx-nodefault.conf" mode: "0644" @@ -127,7 +127,7 @@ - Restart web server - name: Create systemd dropin for rh like systems - import_role: + ansible.builtin.import_role: name: systemd_service when: - ansible_facts['pkg_mgr'] == 'dnf' @@ -145,7 +145,7 @@ - Restart web server - name: Configure nginx virtual hosts - template: + ansible.builtin.template: src: ironic-ipxe.conf.j2 dest: "/etc/nginx/{{ ironic_nginx_conf_path }}/ironic-ipxe.conf" mode: "0644" @@ -154,7 +154,7 @@ - Restart web server - name: Link to enable nginx virtual hosts - file: + ansible.builtin.file: src: "/etc/nginx/sites-available/ironic-ipxe.conf" path: "/etc/nginx/sites-enabled/ironic-ipxe.conf" state: link diff --git a/tasks/ironic_db_setup.yml b/tasks/ironic_db_setup.yml index 37eaba76..0c558bc8 100644 --- a/tasks/ironic_db_setup.yml +++ b/tasks/ironic_db_setup.yml @@ -14,14 +14,14 @@ # limitations under the License. - name: Update database schema - command: "{{ ironic_bin }}/ironic-dbsync upgrade" + ansible.builtin.command: "{{ ironic_bin }}/ironic-dbsync upgrade" become: true become_user: "{{ ironic_system_user_name }}" changed_when: false when: inventory_hostname in groups['ironic_conductor'][0] - name: Update database schema - command: "{{ ironic_bin }}/ironic-inspector-dbsync --config-file /etc/ironic-inspector/ironic-inspector.conf upgrade" + ansible.builtin.command: "{{ ironic_bin }}/ironic-inspector-dbsync --config-file /etc/ironic-inspector/ironic-inspector.conf upgrade" become: true changed_when: false when: diff --git a/tasks/ironic_deploy_image.yml b/tasks/ironic_deploy_image.yml index 4b13cc82..df4654b8 100644 --- a/tasks/ironic_deploy_image.yml +++ b/tasks/ironic_deploy_image.yml @@ -24,14 +24,14 @@ ansible_python_interpreter: "{{ ironic_service_setup_host_python_interpreter }}" block: - name: Create image download directory - file: + ansible.builtin.file: path: "{{ ironic_deploy_image_path }}" state: directory mode: "0750" owner: "{{ ironic_deploy_image_path_owner }}" - name: Download image from artefact server - get_url: + ansible.builtin.get_url: url: "{{ item['url'] }}" dest: "{{ ironic_deploy_image_path }}" checksum: "sha256:{{ item['sha_url'] }}" diff --git a/tasks/ironic_inspector_post_install.yml b/tasks/ironic_inspector_post_install.yml index 8f5a009a..cd4e397c 100644 --- a/tasks/ironic_inspector_post_install.yml +++ b/tasks/ironic_inspector_post_install.yml @@ -14,13 +14,13 @@ # limitations under the License. - name: Default pxelinux.0 config - template: + ansible.builtin.template: src: pxelinux-default.j2 dest: "{{ ironic_inspector_tftpboot_dir }}/pxelinux.cfg/default" mode: "0644" - name: Copy Inspector iPXE Configuration - template: + ansible.builtin.template: src: inspector.ipxe.j2 dest: "{{ ironic_http_root }}/inspector.ipxe" owner: "{{ ironic_system_user_name }}" @@ -28,7 +28,7 @@ mode: "0644" - name: Download IPA Images - get_url: + ansible.builtin.get_url: url: "{{ item.url }}" dest: "{{ ironic_inspector_httpboot_dir }}/{{ item.name }}" checksum: "sha256:{{ item.sha_url }}" @@ -41,21 +41,21 @@ when: ironic_inspector_boot_mode == 'http' block: - name: Disable default nginx configuration - file: + ansible.builtin.file: path: /etc/nginx/sites-enabled/default state: absent notify: - Restart web server - name: Remove default nginx config - file: + ansible.builtin.file: path: /etc/nginx/conf.d/default.conf state: absent notify: - Restart web server - name: Ensure nginx configuration directories exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: "0755" @@ -63,7 +63,7 @@ - "/etc/nginx/{{ ironic_nginx_conf_path }}" - name: Write alternate nginx.conf for rh like systems - template: + ansible.builtin.template: src: nginx-nodefault.conf.j2 dest: "/etc/nginx/nginx-nodefault.conf" mode: "0644" @@ -73,7 +73,7 @@ - Restart web server - name: Create systemd dropin for rh like systems - import_role: + ansible.builtin.import_role: name: systemd_service when: - ansible_facts['pkg_mgr'] == 'dnf' @@ -91,7 +91,7 @@ - Restart web server - name: Configure nginx virtual hosts - template: + ansible.builtin.template: src: ironic-ipxe.conf.j2 dest: "/etc/nginx/{{ ironic_nginx_conf_path }}/ironic-ipxe.conf" mode: "0644" @@ -99,7 +99,7 @@ - Restart web server - name: Link to enable nginx virtual hosts - file: + ansible.builtin.file: src: "/etc/nginx/sites-available/ironic-ipxe.conf" path: "/etc/nginx/sites-enabled/ironic-ipxe.conf" state: link diff --git a/tasks/ironic_inspector_pre_install.yml b/tasks/ironic_inspector_pre_install.yml index ebbdf55e..06092298 100644 --- a/tasks/ironic_inspector_pre_install.yml +++ b/tasks/ironic_inspector_pre_install.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Copy in dhcp config file - template: + ansible.builtin.template: src: "dhcpd.conf.j2" dest: "/etc/dhcp/dhcpd.conf" mode: "0644" @@ -23,7 +23,7 @@ - Restart isc-dhcp-server - name: Copy in dnsmasq config file - template: + ansible.builtin.template: src: "dnsmasq.conf.j2" dest: "/etc/ironic-inspector/inspector-dnsmasq.conf" owner: "{{ ironic_system_user_name }}" @@ -34,7 +34,7 @@ - Restart ironic-inspector-dnsmasq - name: Create directories - file: + ansible.builtin.file: path: "{{ item }}" state: directory owner: "{{ ironic_system_user_name }}" diff --git a/tasks/ironic_post_install.yml b/tasks/ironic_post_install.yml index bd41987f..3ab80dfd 100644 --- a/tasks/ironic_post_install.yml +++ b/tasks/ironic_post_install.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Post swift tempURL secret key - command: > + ansible.builtin.command: > {{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure', '--os-cacert ' ~ _ironic_ssl_truststore_location) }} --os-username "service:{{ glance_service_user_name }}" --os-password "{{ glance_service_password }}" @@ -32,7 +32,7 @@ - always - name: Get swift account - shell: > + ansible.builtin.shell: > {{ ironic_bin }}/swift {{ keystone_service_adminuri_insecure | bool | ternary('--insecure', '--os-cacert ' ~ _ironic_ssl_truststore_location) }} --os-username "service:{{ glance_service_user_name }}" --os-password "{{ glance_service_password }}" @@ -51,7 +51,7 @@ - always - name: Validate swift output - fail: + ansible.builtin.fail: msg: | No StorageURL output found using the `swift stat` command and either the ``ironic_swift_auth_account`` or ``ironic_swift_auth_account`` @@ -66,7 +66,7 @@ - always - name: Set the swift auth facts - set_fact: + ansible.builtin.set_fact: ironic_swift_auth_account: "{{ swift_storage_url.stdout.split('/v1/')[-1] }}" when: - not ironic_enable_web_server_for_images | bool @@ -76,7 +76,7 @@ - always - name: Set the swift endpoint facts - set_fact: + ansible.builtin.set_fact: ironic_swift_endpoint: "{{ swift_storage_url.stdout.split('/v1/')[0] }}" when: - not ironic_enable_web_server_for_images | bool @@ -136,7 +136,7 @@ - ironic-policy-override - name: Remove legacy policy.yaml file - file: + ansible.builtin.file: path: "/etc/ironic/policy.yaml" state: absent when: @@ -145,7 +145,7 @@ - ironic-policy-override - name: Copy rootwrap filters - copy: + ansible.builtin.copy: src: "{{ item }}" dest: "/etc/ironic/rootwrap.d/" owner: "root" @@ -158,7 +158,7 @@ - Restart uwsgi services - name: Include sudoers file - template: + ansible.builtin.template: src: "sudoers.j2" dest: "/etc/sudoers.d/{{ ironic_system_user_name }}_sudoers" mode: "0440" diff --git a/tasks/ironic_pre_install.yml b/tasks/ironic_pre_install.yml index a5e02f7b..0c3cddf6 100644 --- a/tasks/ironic_pre_install.yml +++ b/tasks/ironic_pre_install.yml @@ -14,13 +14,13 @@ # limitations under the License. - name: Create the system group - group: + ansible.builtin.group: name: "{{ ironic_system_group_name }}" state: "present" system: "yes" - name: Create ironic system users - user: + ansible.builtin.user: name: "{{ ironic_system_user_name }}" group: "{{ ironic_system_group_name }}" comment: "{{ ironic_system_comment }}" @@ -30,7 +30,7 @@ home: "{{ ironic_system_home_folder }}" - name: Create ironic dir - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory owner: "{{ item.owner | default(ironic_system_user_name) }}" diff --git a/tasks/main.yml b/tasks/main.yml index e7d5dffe..40dc05fb 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: Gathering facts on metal hosts for interface {{ ironic_container_network_name }} - setup: + ansible.builtin.setup: gather_subset: "!all,network" filter: "{{ dynamic_address_gather_filter | default(('ansible_' ~ default_network_interface_name) | replace('-','_')) }}" vars: @@ -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.db_setup role - include_role: + ansible.builtin.include_role: name: openstack.osa.db_setup apply: tags: @@ -85,7 +85,7 @@ - always - name: Including osa.mq_setup role - include_role: + ansible.builtin.include_role: name: openstack.osa.mq_setup apply: tags: @@ -111,12 +111,12 @@ - always - name: Importing ironic_pre_install tasks - import_tasks: ironic_pre_install.yml + ansible.builtin.import_tasks: ironic_pre_install.yml tags: - ironic-install - name: Create and install SSL certificates - include_role: + ansible.builtin.include_role: name: pki tasks_from: main_certs.yml apply: @@ -137,7 +137,7 @@ - always - name: Install the python venv - import_role: + ansible.builtin.import_role: name: "python_venv_build" vars: venv_python_executable: "{{ ironic_venv_python_executable }}" @@ -155,13 +155,13 @@ - ironic-install - name: Importing ironic_post_install tasks - import_tasks: ironic_post_install.yml + ansible.builtin.import_tasks: ironic_post_install.yml tags: - ironic-config - post-install - name: Import uwsgi role - import_role: + ansible.builtin.import_role: name: uwsgi vars: uwsgi_services: "{{ uwsgi_ironic_services }}" @@ -171,24 +171,24 @@ - uwsgi - name: Importing ironic_conductor_post_install tasks - import_tasks: ironic_conductor_post_install.yml + ansible.builtin.import_tasks: ironic_conductor_post_install.yml when: "ironic_services['ironic-conductor']['group'] in group_names" tags: - ironic-config - name: Importing ironic_db_setup tasks - import_tasks: ironic_db_setup.yml + ansible.builtin.import_tasks: ironic_db_setup.yml tags: - ironic-config - name: Importing ironic_inspector_pre_install tasks - import_tasks: ironic_inspector_pre_install.yml + ansible.builtin.import_tasks: ironic_inspector_pre_install.yml when: inventory_hostname in groups['ironic_inspector'] tags: - ironic-inspector - name: Run the systemd service role - import_role: + ansible.builtin.import_role: name: systemd_service vars: systemd_user_name: "{{ ironic_system_user_name }}" @@ -206,7 +206,7 @@ - systemd-service - name: Including osa.service_setup role - include_role: + ansible.builtin.include_role: name: openstack.osa.service_setup apply: tags: @@ -227,13 +227,13 @@ - always - name: Importing ironic_inspector_post_install tasks - import_tasks: ironic_inspector_post_install.yml + ansible.builtin.import_tasks: ironic_inspector_post_install.yml when: inventory_hostname in groups['ironic_inspector'] tags: - ironic-inspector - name: Including ironic_deploy_image tasks - include_tasks: ironic_deploy_image.yml + ansible.builtin.include_tasks: ironic_deploy_image.yml args: apply: tags: