diff --git a/host_vars/sapt-labp-app01.yml b/host_vars/sapt-labp-app01.yml index 9a7c792..930ee3b 100644 --- a/host_vars/sapt-labp-app01.yml +++ b/host_vars/sapt-labp-app01.yml @@ -1,6 +1,9 @@ # vim: ft=yaml.ansible # code: language=ansible --- +fqdn: sapt-labp-app01.prod.servers.sapti.me +private_ip: 10.2.16.10 + apps_include: - postfix - nextcloud diff --git a/host_vars/sapt-labp-app02.yml b/host_vars/sapt-labp-app02.yml index a54f22c..1e818fd 100644 --- a/host_vars/sapt-labp-app02.yml +++ b/host_vars/sapt-labp-app02.yml @@ -1,6 +1,9 @@ # vim: ft=yaml.ansible # code: language=ansible --- +fqdn: sapt-labp-app02.prod.servers.sapti.me +private_ip: 10.2.16.11 + apps_include: - ipfs - monerod diff --git a/host_vars/sapt-labp-db01.yml b/host_vars/sapt-labp-db01.yml new file mode 100644 index 0000000..e3b1f3e --- /dev/null +++ b/host_vars/sapt-labp-db01.yml @@ -0,0 +1,5 @@ +# vim: ft=yaml.ansible +# code: language=ansible +--- +fqdn: sapt-labp-db01.prod.servers.sapti.me +private_ip: 10.2.16.20 diff --git a/host_vars/sapt-labr-mon01.yml b/host_vars/sapt-labr-mon01.yml new file mode 100644 index 0000000..87a1b46 --- /dev/null +++ b/host_vars/sapt-labr-mon01.yml @@ -0,0 +1,5 @@ +# vim: ft=yaml.ansible +# code: language=ansible +--- +fqdn: sapt-labr-mon01.shrd.servers.sapti.me +private_ip: 10.2.18.20 diff --git a/host_vars/sapt-labr-prx01.yml b/host_vars/sapt-labr-prx01.yml new file mode 100644 index 0000000..e978ca1 --- /dev/null +++ b/host_vars/sapt-labr-prx01.yml @@ -0,0 +1,7 @@ +# vim: ft=yaml.ansible +# code: language=ansible +--- +fqdn: sapt-labr-prx01.shrd.servers.sapti.me +private_ip: 10.2.18.10 + +proxy_mode: global diff --git a/host_vars/sapt-labr-prx02.yml b/host_vars/sapt-labr-prx02.yml new file mode 100644 index 0000000..27c6446 --- /dev/null +++ b/host_vars/sapt-labr-prx02.yml @@ -0,0 +1,7 @@ +# vim: ft=yaml.ansible +# code: language=ansible +--- +fqdn: sapt-labr-prx02.shrd.servers.sapti.me +private_ip: 10.2.18.11 + +proxy_mode: local diff --git a/host_vars/sapt-labs-app01.yml b/host_vars/sapt-labs-app01.yml index 9a7c792..30a1547 100644 --- a/host_vars/sapt-labs-app01.yml +++ b/host_vars/sapt-labs-app01.yml @@ -1,6 +1,9 @@ # vim: ft=yaml.ansible # code: language=ansible --- +fqdn: sapt-labs-app01.stage.servers.sapti.me +private_ip: 10.2.19.10 + apps_include: - postfix - nextcloud diff --git a/host_vars/sapt-labs-app02.yml b/host_vars/sapt-labs-app02.yml index a54f22c..9a885a9 100644 --- a/host_vars/sapt-labs-app02.yml +++ b/host_vars/sapt-labs-app02.yml @@ -1,6 +1,9 @@ # vim: ft=yaml.ansible # code: language=ansible --- +fqdn: sapt-labs-app02.stage.servers.sapti.me +private_ip: 10.2.19.11 + apps_include: - ipfs - monerod diff --git a/host_vars/sapt-labs-db01.yml b/host_vars/sapt-labs-db01.yml new file mode 100644 index 0000000..734d114 --- /dev/null +++ b/host_vars/sapt-labs-db01.yml @@ -0,0 +1,5 @@ +# vim: ft=yaml.ansible +# code: language=ansible +--- +fqdn: sapt-labs-db01.stage.servers.sapti.me +private_ip: 10.2.19.20 diff --git a/host_vars/sapt-labx-ctl01.yml b/host_vars/sapt-labx-ctl01.yml new file mode 100644 index 0000000..ad46d8e --- /dev/null +++ b/host_vars/sapt-labx-ctl01.yml @@ -0,0 +1,4 @@ +# vim: ft=yaml.ansible +# code: language=ansible +--- +fqdn: sapt-labx-ctl01.infr.servers.sapti.me diff --git a/host_vars/sapt-labx-pve01.yml b/host_vars/sapt-labx-pve01.yml new file mode 100644 index 0000000..1269e43 --- /dev/null +++ b/host_vars/sapt-labx-pve01.yml @@ -0,0 +1,4 @@ +# vim: ft=yaml.ansible +# code: language=ansible +--- +fqdn: sapt-labx-pve01.infr.servers.sapti.me diff --git a/inventory.ini b/inventory.ini index 4403425..4689ebb 100644 --- a/inventory.ini +++ b/inventory.ini @@ -1,22 +1,29 @@ [app_prod] -sapt-labp-app01 ansible_host=sapt-labp-app01.servers.local.sapti.me -sapt-labp-app02 ansible_host=sapt-labp-app02.servers.local.sapti.me +sapt-labp-app01 ansible_host=192.168.17.30 +sapt-labp-app02 ansible_host=192.168.17.31 [db_prod] -sapt-labp-db01 ansible_host=sapt-labp-db01.servers.local.sapti.me +sapt-labp-db01 ansible_host=192.168.17.40 [app_stage] -sapt-labs-app01 ansible_host=sapt-labs-app01.servers.local.sapti.me -sapt-labs-app02 ansible_host=sapt-labs-app02.servers.local.sapti.me +sapt-labs-app01 ansible_host=192.168.17.50 +sapt-labs-app02 ansible_host=192.168.17.51 [db_stage] -sapt-labs-db01 ansible_host=sapt-labs-db01.servers.local.sapti.me +sapt-labs-db01 ansible_host=192.168.17.60 -[proxy_shd] -sapt-labn-prx01 ansible_host=sapt-labn-prx01.servers.local.sapti.me +[proxy_shrd] +sapt-labr-prx01 ansible_host=192.168.17.10 +sapt-labr-prx02 ansible_host=192.168.17.11 -[monitoring_shd] -sapt-labn-mon01 ansible_host=sapt-labn-mon01.servers.local.sapti.me +[monitoring_shrd] +sapt-labr-mon01 ansible_host=192.168.17.20 + +[vmhost_infr] +sapt-labx-pve01 ansible_host=192.168.17.3 + +[control_infr] +sapt-labx-ctl01 ansible_host=192.168.17.8 [production:children] app_prod @@ -27,8 +34,8 @@ app_stage db_stage [shared:children] -proxy_shd -monitoring_shd +proxy_shrd +monitoring_shrd [appservers:children] app_prod @@ -36,4 +43,13 @@ app_stage [dbservers:children] db_prod -db_stage \ No newline at end of file +db_stage + +[virtualservers:children] +production +staging +shared + +[physicalservers:children] +vmhost_infr +control_infr \ No newline at end of file diff --git a/roles/common/templates/etc/hosts.j2 b/roles/common/templates/etc/hosts.j2 index 7099f29..b1e62be 100644 --- a/roles/common/templates/etc/hosts.j2 +++ b/roles/common/templates/etc/hosts.j2 @@ -1,6 +1,6 @@ # code: language=ansible-jinja -127.0.1.1 {{ hostname }} {{ hostname }} 127.0.0.1 localhost +127.0.1.1 {{ hostname }} # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback @@ -11,8 +11,6 @@ ff02::2 ip6-allrouters ff02::3 ip6-allhosts # Static hostnames for VMs -{% for host in groups['all'] %} -{% if 'ansible_eth1' in hostvars[host] %} -{{ hostvars[host].ansible_eth1.ipv4.address }} {{ hostvars[host].ansible_host }} -{% endif %} +{% for host in groups['virtualservers'] %} +{{ hostvars[host].private_ip }} {{ hostvars[host].fqdn }} {% endfor %}