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 <will@stackhpc.com>
This commit is contained in:
Will Szumski
2025-10-17 16:05:10 +00:00
parent 15353c00b3
commit 2f8cc7bec1
17 changed files with 60 additions and 54 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -12,4 +12,4 @@
- opensm
roles:
- role: opensm
opensm_action: "{{ kayobe_action }}"
opensm_action: "{{ kayobe_action | default('deploy') }}"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 }}"

View File

@@ -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 }}"

View File

@@ -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 }}"

View File

@@ -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 }}"

View File

@@ -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:

View File

@@ -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:

View File

@@ -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

View File

@@ -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

View File

@@ -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