From c9e2888390e16ca644a667da0b8d442938f16a0e Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 13 Sep 2020 22:19:37 +0200 Subject: add constructed inventory --- ansible.cfg | 7 ++++++- inventory/constructed.yml | 4 ++++ inventory/hosts.ini | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 inventory/constructed.yml diff --git a/ansible.cfg b/ansible.cfg index 6dff2c62..ef74d99c 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,5 +1,5 @@ [defaults] -inventory = ./inventory/hosts.ini +inventory = ./inventory/hosts.ini, ./inventory/constructed.yml roles_path = ./.galaxy:./roles nocows = 1 @@ -29,6 +29,11 @@ force_valid_group_names = ignore #strategy_plugins = ./contrib/mitogen/ansible_mitogen/plugins/strategy #strategy = mitogen_linear + +[inventory] +enable_plugins = constructed, ini + + [ssh_connection] pipelining = True ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s diff --git a/inventory/constructed.yml b/inventory/constructed.yml new file mode 100644 index 00000000..2a7a0fe1 --- /dev/null +++ b/inventory/constructed.yml @@ -0,0 +1,4 @@ +plugin: constructed +strict: True +compose: + host_name: "host_name | default(inventory_hostname)" diff --git a/inventory/hosts.ini b/inventory/hosts.ini index c26678b9..41a9b0b2 100644 --- a/inventory/hosts.ini +++ b/inventory/hosts.ini @@ -1,5 +1,4 @@ [all:vars] -host_name={{ inventory_hostname }} ansible_user=root ansible_port=222 ansible_python_interpreter=/usr/bin/python3 -- cgit v1.2.3