node provision, generate ansible inventory

Generate an ansible inventory from neutron resource
information when network port management is enabled
in the overcloud node provision cli workflow.

Partial-Implements: blueprint network-data-v2-ports
Depends-On: https://review.opendev.org/771291
Depends-On: https://review.opendev.org/771292
Change-Id: I7737f9fc5104b769ef78b76e20a019cc1dafba8f
This commit is contained in:
Harald Jensås 2021-01-19 01:59:36 +01:00
parent 34e324638c
commit db36cf0b8f
2 changed files with 22 additions and 1 deletions

View File

@ -141,7 +141,8 @@ def run_module():
python_interpretor,
ssh_user,
ssh_private_key_file,
ssh_network)
ssh_network,
conn.session)
result['inventory_path'] = inventory_path
result['success'] = True
result['changed'] = True

View File

@ -23,6 +23,9 @@
vars:
node_timeout: 3600
concurrency: 20
ssh_network: ctlplane
python_interpreter: null
ssh_private_key_file: /home/stack/.ssh/id_rsa
pre_tasks:
- fail:
@ -172,3 +175,20 @@
dest: "{{ baremetal_deployed_path }}"
content: "{{ network_ports_environment.environment | default({}) | to_nice_yaml(indent=2) }}"
when: manage_network_ports|default(false)
- name: Ensure inventory working directory exists
file:
path: "{{ output_dir }}/{{ stack_name }}"
state: directory
when:
- manage_network_ports|default(false)
- name: Generate ansible inventory
tripleo_generate_ansible_inventory:
plan: "{{ stack_name }}"
work_dir: "{{ output_dir }}/{{ stack_name }}"
ssh_network: "{{ ssh_network }}"
ansible_ssh_user: "{{ ssh_user_name }}"
ansible_python_interpreter: "{{ python_interpreter }}"
ansible_ssh_private_key_file: "{{ ssh_private_key_file }}"
when: manage_network_ports|default(false)