ΠΡΠ΅ΠΎΠ±ΡΠ°Π·ΠΎΠ²Π°Π½ΠΈΠ΅ ΡΠΎΡΠΌΠ°ΡΠ° ΠΈΠ½Π²Π΅Π½ΡΠΎΡΠΈ Ansible ΠΈΠ· TOML Π² YAML.
ΠΡΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ ΠΏΡΠΈΠΌΠ΅ΡΠ° Π² ΡΠΎΡΠΌΠ°ΡΠ΅ TOML.
$ cat hosts
[executor] localhost ansible_connection=local [external_webserver] hosting01 ansible_host=172.16.15.90 [external_relay] hosting02 ansible_host=172.16.15.91 [external_apps] hosting03 ansible_host=172.16.15.92 [internal_lxd] basilisk ansible_host=172.16.15.11 manticore ansible_host=172.16.15.12 [external:children] external_webserver external_relay [internal:children] internal_lxd [all:vars] ntp_server=ntp.ubuntu.com [external:vars] overlay_network=False [internal:vars] overlay_network=True
ΠΡΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ Π²ΡΡΠ΅ΡΠΏΠΎΠΌΡΠ½ΡΡΠΎΠ³ΠΎ ΠΈΠ½Π²Π΅Π½ΡΠΎΡΠΈ Π² ΡΠΎΡΠΌΠ°ΡΠ΅ YAML.
$ ansible-inventory --inventory hosts --list --yaml
all:
children:
executor:
hosts:
localhost:
ansible_connection: local
ntp_server: ntp.ubuntu.com
external:
children:
external_relay:
hosts:
hosting02:
ansible_host: 172.16.15.91
ntp_server: ntp.ubuntu.com
overlay_network: false
external_webserver:
hosts:
hosting01:
ansible_host: 172.16.15.90
ntp_server: ntp.ubuntu.com
overlay_network: false
external_apps:
hosts:
hosting03:
ansible_host: 172.16.15.92
ntp_server: ntp.ubuntu.com
internal:
children:
internal_lxd:
hosts:
basilisk:
ansible_host: 172.16.15.11
ntp_server: ntp.ubuntu.com
overlay_network: true
manticore:
ansible_host: 172.16.15.12
ntp_server: ntp.ubuntu.com
overlay_network: true
ungrouped: {}
Π‘ΠΎΡ ΡΠ°Π½ΠΈΠΌ Π²ΡΡΠ΅ΡΠΏΠΎΠΌΡΠ½ΡΡΡΠΉ ΡΠ°ΠΉΠ» Π² ΡΠΎΡΠΌΠ°ΡΠ΅ YAML.
$ ansible-inventory --inventory hosts --list --yaml | tee hosts.yaml 1>/dev/null
![]()
