diff --git a/inventories/host_vars/hosts_hayaworld.yml b/inventories/host_vars/hosts_hayaworld.yml deleted file mode 100644 index 663db56..0000000 --- a/inventories/host_vars/hosts_hayaworld.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -hosts_hayaworld: - - A: g - IP: 0.0.0.0 - - A: g.hayaworld.local - IP: 0.0.0.0 - - A: skylark.hayaworld.local - IP: 192.168.1.200 - - A: nuc01.hayaworld.local - IP: 192.168.1.11 - - A: nuc02.hayaworld.local - IP: 192.168.1.12 - - A: vcsa.hayaworld.local - IP: 192.168.1.10 - - A: rui.hayaworld.local - IP: 192.168.1.100 - - A: win10.hayaworld.local - IP: 192.168.1.101 - - A: runner.hayaworld.local - IP: 192.168.1.104 - - A: console.hayaworld.local - IP: 192.168.1.105 - - A: zabbix.hayaworld.local - IP: 192.168.1.106 - - A: docker.hayaworld.local - IP: 192.168.1.107 - - A: ubuntu.hayaworld.local - IP: 192.168.1.110 - - A: step.hayaworld.local - IP: 192.168.1.111 - - A: tm.hayaworld.local - IP: 192.168.1.112 - - A: jenkins.hayaworld.local - IP: 192.168.1.131 - - A: glusternfs.hayaworld.local - IP: 192.168.1.140 - - A: glusternfs001.hayaworld.local - IP: 192.168.1.141 - - A: glusternfs002.hayaworld.local - IP: 192.168.1.142 - - A: glusternfs003.hayaworld.local - IP: 192.168.1.143 - - A: vesxi01.hayaworld.local - IP: 192.168.1.151 - - A: vesxi02.hayaworld.local - IP: 192.168.1.152 - - A: vrli.hayaworld.local - IP: 192.168.1.160 diff --git a/inventories/host_vars/networks.yml b/inventories/host_vars/networks.yml index 0bd9af4..0daffea 100644 --- a/inventories/host_vars/networks.yml +++ b/inventories/host_vars/networks.yml @@ -45,11 +45,12 @@ network: interface: ens160 ipv4: 192.168.1.200 shortname: skylark + +network_dhcp: macbook: hostname: HayabookAir2023.hayaworld.local shortname: HayabookAir2023 - subnet: mask: 24 gw4: 192.168.1.1 diff --git a/macbook.yml b/macbook.yml index ee94d50..448f2ab 100644 --- a/macbook.yml +++ b/macbook.yml @@ -12,7 +12,7 @@ tasks: - name: Set Hostname ansible.builtin.hostname: - name: "{{ network.macbook.hostname }}" + name: "{{ network_dhcp.macbook.hostname }}" become: true tags: - network diff --git a/rui.yml b/rui.yml index ff4483e..8631a5f 100644 --- a/rui.yml +++ b/rui.yml @@ -11,7 +11,6 @@ - inventories/host_vars/rui/ads_hosts/NXDOMAIN.yml - inventories/host_vars/rui/ads_hosts/NXDOMAIN_book_scam.yml - inventories/host_vars/rui.yml - - inventories/host_vars/hosts_hayaworld.yml - inventories/host_vars/networks.yml handlers: diff --git a/templates/rui/etc/hosts.j2 b/templates/rui/etc/hosts.j2 index 303b6e6..71cec9b 100644 --- a/templates/rui/etc/hosts.j2 +++ b/templates/rui/etc/hosts.j2 @@ -1,6 +1,6 @@ 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 -{% for item in hosts_hayaworld %} -{{ item.IP }} {{ item.A }} +{% for host in network.values() %} +{{ host.ipv4 }} {{ host.hostname }} {% endfor %}