changes to in-memory generation to better support single or multi-host runs

This commit is contained in:
2022-05-03 23:06:28 -04:00
parent 0af3f072d2
commit 2454dcaa9d
5 changed files with 101 additions and 77 deletions

View File

@ -1,5 +1,5 @@
---
- name: Create inventory based on passed extra_vars
- name: Create inventory based on extra_vars
hosts: all
gather_facts: no
become: no
@ -10,16 +10,17 @@
vars:
provision_host: "{{ tower_provision_host | default(ansible_play_hosts | random) }}"
provision_host: "{{ tower_provision_host | default(ansible_play_hosts | join(',')) }}"
tasks:
- name: "Create in-memory inventory for {{ provision_host }}"
- name: "Create in-memory inventory"
add_host:
name: "{{ provision_host }}"
name: "{{ item }}"
groups:
- remdiation
delegate_to: localhost
loop: "{{ provision_host.split(',') }}"
# =========================================================================== #