zuul/playbooks/zuul-stream/create-inventory.yaml
Ian Wienand 78050adb51 zuul_stream : Use !127.0.0.1 for loopback
This is a follow-on to Ia78ad9e3ec51bc47bf68c9ff38c0fcd16ba2e728 to
use a different loopback address for the local connection to the
Python 2.7 container.  This way, we don't have to override the
existing localhost/127.0.0.1 matches that avoid the executor trying to
talk to a zuul_console daemon.  These bits are removed.

The comment around the port settings is updated while we're here.

Change-Id: I33b2198baba13ea348052e998b1a5a362c165479
2022-09-07 10:48:25 +10:00

39 lines
1020 B
YAML

- name: Copy inventory
copy:
src: "{{ zuul.executor.log_root }}/zuul-info/inventory.yaml"
dest: "{{ ansible_user_dir }}/inventory.yaml"
- name: Slurp inventory
slurp:
path: "{{ ansible_user_dir }}/inventory.yaml"
register: _inventory_yaml
- name: Extract inventory
set_fact:
_new_inventory: "{{ _inventory_yaml['content'] | b64decode | from_yaml }}"
- name: Setup new facts
set_fact:
_docker_inventory:
all:
children:
node:
hosts:
node3: null
hosts:
node3:
ansible_connection: ssh
ansible_host: 127.0.0.2
ansible_port: 2022
ansible_user: root
ansible_python_interpreter: /usr/local/bin/python2.7
- name: Merge all facts
set_fact:
_new_inventory: '{{ _new_inventory | combine(_docker_inventory, recursive=True) }}'
- name: Write out inventory
copy:
content: '{{ _new_inventory | to_nice_yaml }}'
dest: '{{ ansible_user_dir }}/inventory.yaml'