From cade7202bb183703e456824222beca25414dae91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20Cunningham?= <donal.cunningham@heanet.ie> Date: Wed, 8 Dec 2021 14:27:24 +0000 Subject: [PATCH] DC - added generic ansible.cfg and put more example output in the README for inventories --- Section1/ansible.cfg | 10 +++++++ Section1/inventories/README.md | 48 +++++++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 Section1/ansible.cfg diff --git a/Section1/ansible.cfg b/Section1/ansible.cfg new file mode 100644 index 0000000..4977601 --- /dev/null +++ b/Section1/ansible.cfg @@ -0,0 +1,10 @@ +# My own config file, thank goodness! + +[defaults] + +host_key_checking = False +stdout_callback = yaml + +inventory = hosts + +nocows = True diff --git a/Section1/inventories/README.md b/Section1/inventories/README.md index 5cbfe3d..7ab527e 100644 --- a/Section1/inventories/README.md +++ b/Section1/inventories/README.md @@ -9,9 +9,51 @@ You can verify any of them as valid inventories with An example command line is... ``` -ansible-inventory --graph -i hosts.ini +$ ansible-inventory --graph -i hosts_with_variables.ini +@all: + |--@all_servers: + | |--@dbservers: + | | |--db1_dublin + | | |--db2_dublin + | |--@webservers: + | | |--web1_dublin + | | |--web2_dublin + |--@ungrouped: + | |--loadbalancer1 + | |--veos ``` ## Inventory variables -If you want to see the inventory variables too, you -will need to add ``--vars`` to the command line. +If you want to see the inventory variables too, you will need to add ``--vars`` to the command line. + +``` +$ ansible-inventory --graph -i hosts_with_variables.ini --vars +@all: + |--@all_servers: + | |--@dbservers: + | | |--db1_dublin + | | | |--{ansible_ssh_pass = swordfish} + | | | |--{ansible_user = zork} + | | |--db2_dublin + | | | |--{ansible_ssh_pass = swordfish} + | | | |--{ansible_user = zork} + | |--@webservers: + | | |--web1_dublin + | | | |--{ansible_ssh_pass = swordfish} + | | | |--{ansible_user = nginx_test} + | | |--web2_dublin + | | | |--{ansible_ssh_pass = swordfish} + | | | |--{ansible_user = nginx_test} + | | |--{ansible_user = nginx_test} + |--@ungrouped: + | |--loadbalancer1 + | | |--{ansible_ssh_pass = swordfish} + | | |--{ansible_user = zork} + | |--veos + | | |--{ansible_host = localhost} + | | |--{ansible_port = 9022} + | | |--{ansible_ssh_pass = swordfish} + | | |--{ansible_user = zork} + |--{ansible_ssh_pass = swordfish} + |--{ansible_user = zork} +``` -- GitLab