change: inventory to constructed

This commit is contained in:
rcordier 2024-05-22 15:22:38 -04:00
parent 10ec6af097
commit e85210c1b0
4 changed files with 36 additions and 31 deletions

View File

@ -1,26 +1,25 @@
env: env_fake:
children: hosts:
env_fake: local:
vars: fake-client1-web1:
ansible_host: localhost fake-client1-web2:
ansible_connection: local fake-client1-db:
hosts: vars:
local: ansible_host: localhost
fake-client1-web1: ansible_connection: local
fake-client1-web2: environment_name2: fake5
fake-client1-db:
roles: roles:
children: children:
role_web: role_web:
hosts: hosts:
fake-client1-web1: fake-client1-web1:
fake-client1-web2: fake-client1-web2:
vars: #vars:
ansible_user: root # ansible_user: root
role_db: role_db:
hosts: hosts:
fake-client1-db: fake-client1-db:
#vars: #vars:
# ansible_become: true # ansible_become: true
# ansible_become_pass: password # ansible_become_pass: password

View File

@ -2,16 +2,12 @@
env_lab: env_lab:
hosts: hosts:
rocky-1: rocky-1:
ansible_host: 192.168.122.129 #ansible_host: 192.168.122.129
rocky-2: rocky-2:
ansible_host: 192.168.122.19 #ansible_host: 192.168.122.19
vars: vars:
ansible_user: cloud-user ansible_user: cloud-user
environment_name2: lab5
# Inject environment
env:
children:
env_lab:
# Inject roles # Inject roles
roles: roles:
@ -22,6 +18,3 @@ roles:
role_db: role_db:
hosts: hosts:
rocky-2: rocky-2:
vars:
environment_name: lab

View File

@ -0,0 +1,13 @@
# inventory.config file in YAML format
# Documentation: ansible-doc -t inventory ansible.builtin.constructed
#
# Reproduce AWX behavior for constructed inventories
plugin: ansible.builtin.constructed
strict: False
keyed_groups:
- prefix: env_
key: environment_name
parent_group: env