From 2f8cc7bec13180e247a4491eb5ae69621a50bf4e Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Fri, 17 Oct 2025 16:05:10 +0000 Subject: [PATCH] Replace local_action with delegate to localhost In preparation for the ansible bump: [DEPRECATION WARNING]: Using a mapping for `action` is deprecated. This feature will be removed from ansible-core version 2.23. Origin: /home/ubuntu/kayobe/ansible/roles/ssh-known-host/tasks/main.yml:31:5 29 - name: Ensure SSH keys are in known hosts 30 local_action: 31 module: known_hosts ^ column 5 Use a string value for `action`. Change-Id: I9ac26db07f68ecd3859412d3d33a964342be4cd0 Signed-off-by: Will Szumski --- ...baremetal-compute-introspection-data-save.yml | 8 ++++---- ansible/docker-registry.yml | 2 +- ansible/drac-facts.yml | 8 ++++---- ansible/dump-config.yml | 16 ++++++++-------- ansible/opensm.yml | 2 +- ansible/overcloud-introspection-data-save.yml | 8 ++++---- ansible/overcloud-inventory-discover.yml | 4 ++-- ansible/overcloud-provision.yml | 4 ++-- ansible/roles/console-allocation/tasks/main.yml | 4 ++-- ansible/roles/dell-switch/tasks/main.yml | 12 ++++++------ ansible/roles/ip-allocation/tasks/main.yml | 4 ++-- ansible/roles/junos-switch/tasks/main.yml | 4 ++-- .../molecule/enable-everything/prepare.yml | 16 ++++++++-------- ansible/roles/ssh-known-host/tasks/main.yml | 8 ++++---- ansible/seed-manage-containers.yml | 4 ++-- ansible/seed-vm-provision.yml | 4 ++-- requirements.yml | 6 ++++++ 17 files changed, 60 insertions(+), 54 deletions(-) diff --git a/ansible/baremetal-compute-introspection-data-save.yml b/ansible/baremetal-compute-introspection-data-save.yml index 0d07932a2..505349e5a 100644 --- a/ansible/baremetal-compute-introspection-data-save.yml +++ b/ansible/baremetal-compute-introspection-data-save.yml @@ -44,14 +44,14 @@ ansible_host: "{{ hostvars[controller_host].ansible_host | default(controller_host) }}" - name: Ensure introspection data output directory exists - local_action: - module: file + delegate_to: localhost + file: path: "{{ output_dir }}" state: directory - name: Ensure introspection data is saved locally - local_action: - module: copy + delegate_to: localhost + copy: content: "{{ introspection_data_map[output_format | lower] }}" dest: "{{ output_dir }}/{{ inventory_hostname }}.{{ output_format | lower }}" when: save_result.rc == 0 diff --git a/ansible/docker-registry.yml b/ansible/docker-registry.yml index c721e023a..2fb05bb90 100644 --- a/ansible/docker-registry.yml +++ b/ansible/docker-registry.yml @@ -12,5 +12,5 @@ - docker-registry roles: - role: docker-registry - docker_registry_action: "{{ kayobe_action }}" + docker_registry_action: "{{ kayobe_action | default('deploy') }}" docker_registry_config_path: "{{ config_path }}/docker-registry" diff --git a/ansible/drac-facts.yml b/ansible/drac-facts.yml index 41bf7e486..83af97d00 100644 --- a/ansible/drac-facts.yml +++ b/ansible/drac-facts.yml @@ -11,8 +11,8 @@ - role: stackhpc.drac-facts tasks: - name: Gather facts via DRAC - local_action: - module: drac_facts + delegate_to: localhost + drac_facts: address: "{{ ipmi_address }}" username: "{{ ipmi_username }}" password: "{{ ipmi_password }}" @@ -23,7 +23,7 @@ var: result - name: Write facts to a file - local_action: - module: copy + delegate_to: localhost + copy: content: "{{ result }}" dest: "/tmp/drac-facts-{{ inventory_hostname }}.json" diff --git a/ansible/dump-config.yml b/ansible/dump-config.yml index 46ebc089f..f740a063a 100644 --- a/ansible/dump-config.yml +++ b/ansible/dump-config.yml @@ -20,27 +20,27 @@ dump_hosts: all tasks: - name: Create configuration dump directory - local_action: - module: file + delegate_to: localhost + file: path: "{{ dump_path }}" state: directory - name: Write host config to file - local_action: - module: copy + delegate_to: localhost + copy: content: "{{ hostvars[inventory_hostname] | to_nice_yaml }}" dest: "{{ dump_path }}/{{ inventory_hostname }}.yml" when: dump_var_name is not defined - name: Write host variable to file - local_action: - module: copy + delegate_to: localhost + copy: content: "{{ hostvars[inventory_hostname][dump_var_name] | to_nice_yaml }}" dest: "{{ dump_path }}/{{ inventory_hostname }}.yml" when: dump_var_name is defined # - name: Write merged config to file -# local_action: -# module: copy +# delegate_to: localhost +# copy: # content: "{{ hostvars | merge_config | to_nice_yaml }}" # dest: "{{ dump_path }}/merged.yml diff --git a/ansible/opensm.yml b/ansible/opensm.yml index bee7e5175..19b94dd9d 100644 --- a/ansible/opensm.yml +++ b/ansible/opensm.yml @@ -12,4 +12,4 @@ - opensm roles: - role: opensm - opensm_action: "{{ kayobe_action }}" + opensm_action: "{{ kayobe_action | default('deploy') }}" diff --git a/ansible/overcloud-introspection-data-save.yml b/ansible/overcloud-introspection-data-save.yml index 236a06bbb..284a899f2 100644 --- a/ansible/overcloud-introspection-data-save.yml +++ b/ansible/overcloud-introspection-data-save.yml @@ -38,14 +38,14 @@ become: "{{ container_engine == 'podman' }}" - name: Ensure introspection data output directory exists - local_action: - module: file + delegate_to: localhost + file: path: "{{ output_dir }}" state: directory - name: Ensure introspection data is saved locally - local_action: - module: copy + delegate_to: localhost + copy: content: "{{ introspection_data_map[output_format | lower] }}" dest: "{{ output_dir }}/{{ inventory_hostname }}.{{ output_format | lower }}" when: save_result.rc == 0 diff --git a/ansible/overcloud-inventory-discover.yml b/ansible/overcloud-inventory-discover.yml index cabcaa5fd..c41466a53 100644 --- a/ansible/overcloud-inventory-discover.yml +++ b/ansible/overcloud-inventory-discover.yml @@ -23,8 +23,8 @@ ironic_inventory: "{{ inventory_result.stdout | from_json }}" - name: Ensure Kayobe overcloud inventory exists - local_action: - module: copy + delegate_to: localhost + copy: content: | # Managed by Ansible - do not edit. # This is the Kayobe overcloud inventory, autogenerated from the seed diff --git a/ansible/overcloud-provision.yml b/ansible/overcloud-provision.yml index 6b49a6fa0..424b45756 100644 --- a/ansible/overcloud-provision.yml +++ b/ansible/overcloud-provision.yml @@ -221,8 +221,8 @@ - final_provision_state != 'active' - name: Wait for SSH access to the nodes - local_action: - module: wait_for + delegate_to: localhost + wait_for: host: "{{ ansible_host }}" port: 22 state: started diff --git a/ansible/roles/console-allocation/tasks/main.yml b/ansible/roles/console-allocation/tasks/main.yml index 2445181b7..cb67e2f12 100644 --- a/ansible/roles/console-allocation/tasks/main.yml +++ b/ansible/roles/console-allocation/tasks/main.yml @@ -35,8 +35,8 @@ # NOTE(mgoddard): Use the Python interpreter used to run ansible-playbook, # since this has Python dependencies available to it (PyYAML). ansible_python_interpreter: "{{ ansible_playbook_python }}" - local_action: - module: console_allocation + delegate_to: localhost + console_allocation: allocation_file: "{{ console_allocation_filename }}" nodes: "{{ console_allocation_ironic_nodes }}" allocation_pool_start: "{{ console_allocation_pool_start }}" diff --git a/ansible/roles/dell-switch/tasks/main.yml b/ansible/roles/dell-switch/tasks/main.yml index fc3d6268e..958b04b71 100644 --- a/ansible/roles/dell-switch/tasks/main.yml +++ b/ansible/roles/dell-switch/tasks/main.yml @@ -1,23 +1,23 @@ --- - name: Ensure DellOS6 switches are configured - local_action: - module: dellos6_config + delegate_to: localhost + dellemc.os6.os6: provider: "{{ dell_switch_provider }}" src: "{{ lookup('template', 'dellos6-config.j2') }}" save: "{{ dell_switch_save | bool }}" when: dell_switch_type == 'dellos6' - name: Ensure DellOS9 switches are configured - local_action: - module: dellos9_config + delegate_to: localhost + dellemc.os9.os9: provider: "{{ dell_switch_provider }}" src: "{{ lookup('template', 'dellos9-config.j2') }}" save: "{{ dell_switch_save | bool }}" when: dell_switch_type == 'dellos9' - name: Ensure DellOS10 switches are configured - local_action: - module: dellos10_config + delegate_to: localhost + dellemc.os10.os10: provider: "{{ dell_switch_provider }}" src: "{{ lookup('template', 'dellos10-config.j2') }}" save: "{{ dell_switch_save | bool }}" diff --git a/ansible/roles/ip-allocation/tasks/main.yml b/ansible/roles/ip-allocation/tasks/main.yml index 93360a00c..a30457be5 100644 --- a/ansible/roles/ip-allocation/tasks/main.yml +++ b/ansible/roles/ip-allocation/tasks/main.yml @@ -4,8 +4,8 @@ # NOTE(mgoddard): Use the Python interpreter used to run ansible-playbook, # since this has Python dependencies available to it (PyYAML). ansible_python_interpreter: "{{ ansible_playbook_python }}" - local_action: - module: ip_allocation + delegate_to: localhost + ip_allocation: allocation_file: "{{ ip_allocation_filename }}" hostname: "{{ ip_allocation_hostname }}" net_name: "{{ item.net_name }}" diff --git a/ansible/roles/junos-switch/tasks/main.yml b/ansible/roles/junos-switch/tasks/main.yml index d5fea0cce..c76f006f1 100644 --- a/ansible/roles/junos-switch/tasks/main.yml +++ b/ansible/roles/junos-switch/tasks/main.yml @@ -6,8 +6,8 @@ # NOTE(mgoddard): 0.6.7 includes a fix for host key checking: # https://github.com/ncclient/ncclient/issues/302. ncclient_version: ">=0.6.7,<0.7.0" - local_action: - module: pip + delegate_to: localhost + pip: name: "ncclient{{ ncclient_version }}" virtualenv: "{{ lookup('env', 'VIRTUAL_ENV') | default(omit, true) }}" become: "{{ lookup('env', 'VIRTUAL_ENV') == None }}" diff --git a/ansible/roles/kolla-openstack/molecule/enable-everything/prepare.yml b/ansible/roles/kolla-openstack/molecule/enable-everything/prepare.yml index a39c596c9..4e945b3aa 100644 --- a/ansible/roles/kolla-openstack/molecule/enable-everything/prepare.yml +++ b/ansible/roles/kolla-openstack/molecule/enable-everything/prepare.yml @@ -4,8 +4,8 @@ gather_facts: false tasks: - name: Ensure ironic inspector kernel and ramdisk image directory exists - local_action: - module: file + delegate_to: localhost + file: path: "{{ item | dirname }}" state: directory recurse: true @@ -18,8 +18,8 @@ # versions of docker. Using non-empty files seems to resolve the issue. # See https://github.com/ansible/ansible/issues/36725. - name: Ensure ironic inspector kernel and ramdisk images exist - local_action: - module: copy + delegate_to: localhost + copy: content: fake image dest: "{{ item }}" with_items: @@ -117,8 +117,8 @@ label: "{{ item.dest }}" - name: Ensure nova libvirt certificates directory exists - local_action: - module: file + delegate_to: localhost + file: path: "{{ kolla_nova_libvirt_certificates_src }}" state: directory @@ -127,8 +127,8 @@ # versions of docker. Using non-empty files seems to resolve the issue. # See https://github.com/ansible/ansible/issues/36725. - name: Ensure nova libvirt certificates exist - local_action: - module: copy + delegate_to: localhost + copy: content: fake cert dest: "{{ kolla_nova_libvirt_certificates_src }}/{{ item }}" with_items: diff --git a/ansible/roles/ssh-known-host/tasks/main.yml b/ansible/roles/ssh-known-host/tasks/main.yml index a59ceffc1..75257f71c 100644 --- a/ansible/roles/ssh-known-host/tasks/main.yml +++ b/ansible/roles/ssh-known-host/tasks/main.yml @@ -16,8 +16,8 @@ # NOTE(priteau): Exclude comments from ssh-keyscan output because they break # known_hosts on centos/rocky 10. - name: Scan for SSH keys - local_action: - module: shell ssh-keyscan {{ item }} | grep -v '^#' + delegate_to: localhost + shell: ssh-keyscan {{ item }} | grep -v '^#' with_items: - "{{ ansible_host | default(inventory_hostname) }}" register: keyscan_result @@ -27,8 +27,8 @@ # concurrently, and some keys can end up being dropped. For more details see # https://github.com/ansible/proposals/issues/113 - name: Ensure SSH keys are in known hosts - local_action: - module: known_hosts + delegate_to: localhost + known_hosts: host: "{{ item[0].item }}" key: "{{ item[1] }}" with_subelements: diff --git a/ansible/seed-manage-containers.yml b/ansible/seed-manage-containers.yml index dd81a079b..10cd6c0ab 100644 --- a/ansible/seed-manage-containers.yml +++ b/ansible/seed-manage-containers.yml @@ -1,10 +1,10 @@ --- -- name: "Ensure defined container images are {{ kayobe_action }}ed on seed node" +- name: "Ensure defined container images are {{ kayobe_action | default('deploy') }}ed on seed node" hosts: seed tags: - seed-deploy-containers - seed-manage-containers vars: - manage_containers_action: "{{ kayobe_action }}" + manage_containers_action: "{{ kayobe_action | default('deploy') }}" roles: - role: manage-containers diff --git a/ansible/seed-vm-provision.yml b/ansible/seed-vm-provision.yml index 1424cc5b0..87a142121 100644 --- a/ansible/seed-vm-provision.yml +++ b/ansible/seed-vm-provision.yml @@ -124,8 +124,8 @@ console_log_enabled: true tasks: - name: Wait for SSH access to the seed VM - local_action: - module: wait_for + delegate_to: localhost + wait_for: host: "{{ hostvars[seed_host].ansible_host }}" port: 22 state: started diff --git a/requirements.yml b/requirements.yml index ef419f34d..b87c418c3 100644 --- a/requirements.yml +++ b/requirements.yml @@ -5,6 +5,12 @@ collections: version: master - name: community.docker version: 3.11.0 + - name: community.network + version: 5.1.0 + - name: dellemc.os6 + version: 1.0.7 + - name: dellemc.os9 + version: 1.0.4 - name: dellemc.os10 version: 1.2.7 - name: nvidia.nvue