feat: aggiunta sezione inventory
This commit is contained in:
parent
4b97f44c1a
commit
46cc807ad7
6 changed files with 68 additions and 0 deletions
1
2_inventory/10_inventory-test
Normal file
1
2_inventory/10_inventory-test
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
host1.mydomain.xyz
|
||||||
3
2_inventory/11_inventory-test
Normal file
3
2_inventory/11_inventory-test
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[gruppo_test]
|
||||||
|
host1test.mydomain.xyz
|
||||||
|
host2test.mydomain.xyz
|
||||||
3
2_inventory/12_inventory-test
Normal file
3
2_inventory/12_inventory-test
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[gruppo_test]
|
||||||
|
host1test.mydomain.xyz ansible_host=127.0.0.2
|
||||||
|
host2test.mydomain.xyz ansible_host=127.0.0.3
|
||||||
6
2_inventory/13_inventory-test
Normal file
6
2_inventory/13_inventory-test
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[gruppo_test]
|
||||||
|
host1test.mydomain.xyz ansible_host=127.0.0.2
|
||||||
|
host2test.mydomain.xyz ansible_host=127.0.0.3
|
||||||
|
|
||||||
|
[gruppo_test:vars]
|
||||||
|
ansible_user=nobody
|
||||||
17
2_inventory/14_inventory-test
Normal file
17
2_inventory/14_inventory-test
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
[gruppo_test]
|
||||||
|
host1test.mydomain.xyz ansible_host=127.0.0.2
|
||||||
|
host2test.mydomain.xyz ansible_host=127.0.0.3
|
||||||
|
|
||||||
|
[gruppo_prod]
|
||||||
|
host1prod.mydomain.xyz ansible_host=127.0.0.4
|
||||||
|
host2prdo.mydomain.xyz ansible_host=127.0.0.5
|
||||||
|
|
||||||
|
[gruppo_test:vars]
|
||||||
|
ansible_user=nobody
|
||||||
|
|
||||||
|
[gruppo_prod:vars]
|
||||||
|
ansible_user=root
|
||||||
|
|
||||||
|
[gruppo_all:children]
|
||||||
|
gruppo_test
|
||||||
|
gruppo_prod
|
||||||
38
2_inventory/README.md
Normal file
38
2_inventory/README.md
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
# Alcuni esempi pratici di inventory Ansible
|
||||||
|
|
||||||
|
|
||||||
|
1.0) Creare un semplice file di inventory in formato INI:
|
||||||
|
- Il comando crea il file di inventory nominato 10_inventory-test con un unico host host1.mydomain.xyz
|
||||||
|
```
|
||||||
|
echo host1.mydomain.xyz > 10_inventory-test
|
||||||
|
```
|
||||||
|
|
||||||
|
1.1) Esempio file di inventory in formato INI con gruppo:
|
||||||
|
- Nell'inventory è presente il gruppo gruppo_test composto da due hosts
|
||||||
|
```
|
||||||
|
cat 11_inventory-test
|
||||||
|
```
|
||||||
|
|
||||||
|
1.2) Esempio file di inventory in formato INI con gruppo e variabili dei singoli hosts:
|
||||||
|
- Nell'inventory è presente il gruppo gruppo_test composto da due hosts con la variabile che definisce gli IP
|
||||||
|
```
|
||||||
|
cat 12_inventory-test
|
||||||
|
```
|
||||||
|
|
||||||
|
1.3) Esempio file di inventory in formato INI con gruppo e variabili per il gruppo:
|
||||||
|
- Nell'inventory è presente il gruppo gruppo_test composto da due hosts con la variabile che definisce gli IP e la variabile ansible_user valida per l'intero gruppo
|
||||||
|
```
|
||||||
|
cat 13_inventory-test
|
||||||
|
```
|
||||||
|
|
||||||
|
1.4) Esempio file di inventory in formato INI con gruppi, sottogruppi e variabili:
|
||||||
|
- Nell'inventory sono presenti due gruppi, gruppo_test e gruppo_prod. Inoltre è presente il gruppo gruppo_all che comprende i due sottogruppi gruppo_test e gruppo_prod
|
||||||
|
```
|
||||||
|
cat 14_inventory-test
|
||||||
|
```
|
||||||
|
|
||||||
|
2.0) Esempio file di inventory in formato yaml:
|
||||||
|
- Nell'inventory è presente il solo host host1test.mydomain.xyz
|
||||||
|
```
|
||||||
|
cat 20_inventory-test
|
||||||
|
```
|
||||||
Loading…
Add table
Reference in a new issue