inventory: Apply updated terraform script

Update terraform script and apply it to get updated version of ansible
inventory file.

Referenced issue: https://github.com/status-im/infra-template/issues/10

Signed-off-by: markoburcul <marko@status.im>
This commit is contained in:
markoburcul 2024-09-13 17:04:16 +02:00
parent e9ef60b3e5
commit d3ad781cfc
No known key found for this signature in database
GPG Key ID: FC4CD2F9A040D54A
3 changed files with 15 additions and 18 deletions

View File

@ -1,12 +1,12 @@
# NOTE: This file is generated by terraform.py
# For emergency use when Consul fails
[all]
node-01.ac-cn-hongkong-c.waku.sandbox hostname=node-01.ac-cn-hongkong-c.waku.sandbox ansible_host=8.217.37.92 env=waku stage=sandbox data_center=ac-cn-hongkong-c region=cn-hongkong-c dns_entry=node-01.ac-cn-hongkong-c.waku.sandbox.status.im
node-01.do-ams3.waku.sandbox hostname=node-01.do-ams3.waku.sandbox ansible_host=64.225.80.192 env=waku stage=sandbox data_center=do-ams3 region=ams3 dns_entry=node-01.do-ams3.waku.sandbox.status.im
node-01.gc-us-central1-a.waku.sandbox hostname=node-01.gc-us-central1-a.waku.sandbox ansible_host=34.66.89.94 env=waku stage=sandbox data_center=gc-us-central1-a region=us-central1-a dns_entry=node-01.gc-us-central1-a.waku.sandbox.status.im
node-db-01.ac-cn-hongkong-c.waku.sandbox hostname=node-db-01.ac-cn-hongkong-c.waku.sandbox ansible_host=8.218.4.20 env=waku stage=sandbox data_center=ac-cn-hongkong-c region=cn-hongkong-c dns_entry=node-db-01.ac-cn-hongkong-c.waku.sandbox.status.im
node-db-01.do-ams3.waku.sandbox hostname=node-db-01.do-ams3.waku.sandbox ansible_host=24.144.76.217 env=waku stage=sandbox data_center=do-ams3 region=ams3 dns_entry=node-db-01.do-ams3.waku.sandbox.status.im
node-db-01.gc-us-central1-a.waku.sandbox hostname=node-db-01.gc-us-central1-a.waku.sandbox ansible_host=34.69.131.8 env=waku stage=sandbox data_center=gc-us-central1-a region=us-central1-a dns_entry=node-db-01.gc-us-central1-a.waku.sandbox.status.im
node-01.ac-cn-hongkong-c.waku.sandbox ansible_host=8.217.37.92 data_center=ac-cn-hongkong-c dns_domain=status.im dns_entry=node-01.ac-cn-hongkong-c.waku.sandbox.status.im env=waku region=cn-hongkong-c stage=sandbox
node-01.do-ams3.waku.sandbox ansible_host=64.225.80.192 data_center=do-ams3 dns_domain=status.im dns_entry=node-01.do-ams3.waku.sandbox.status.im env=waku region=ams3 stage=sandbox
node-01.gc-us-central1-a.waku.sandbox ansible_host=34.66.89.94 data_center=gc-us-central1-a dns_entry=node-01.gc-us-central1-a.waku.sandbox.status.im env=waku region=us-central1-a stage=sandbox
node-db-01.ac-cn-hongkong-c.waku.sandbox ansible_host=8.218.4.20 data_center=ac-cn-hongkong-c dns_domain=status.im dns_entry=node-db-01.ac-cn-hongkong-c.waku.sandbox.status.im env=waku region=cn-hongkong-c stage=sandbox
node-db-01.do-ams3.waku.sandbox ansible_host=24.144.76.217 data_center=do-ams3 dns_domain=status.im dns_entry=node-db-01.do-ams3.waku.sandbox.status.im env=waku region=ams3 stage=sandbox
node-db-01.gc-us-central1-a.waku.sandbox ansible_host=34.69.131.8 data_center=gc-us-central1-a dns_entry=node-db-01.gc-us-central1-a.waku.sandbox.status.im env=waku region=us-central1-a stage=sandbox
[ac-cn-hongkong-c]
node-01.ac-cn-hongkong-c.waku.sandbox

View File

@ -1,12 +1,12 @@
# NOTE: This file is generated by terraform.py
# For emergency use when Consul fails
[all]
node-01.ac-cn-hongkong-c.waku.test hostname=node-01.ac-cn-hongkong-c.waku.test ansible_host=8.218.219.107 env=waku stage=test data_center=ac-cn-hongkong-c region=cn-hongkong-c dns_entry=node-01.ac-cn-hongkong-c.waku.test.status.im
node-01.do-ams3.waku.test hostname=node-01.do-ams3.waku.test ansible_host=178.128.141.171 env=waku stage=test data_center=do-ams3 region=ams3 dns_entry=node-01.do-ams3.waku.test.status.im
node-01.gc-us-central1-a.waku.test hostname=node-01.gc-us-central1-a.waku.test ansible_host=34.16.1.67 env=waku stage=test data_center=gc-us-central1-a region=us-central1-a dns_entry=node-01.gc-us-central1-a.waku.test.status.im
node-db-01.ac-cn-hongkong-c.waku.test hostname=node-db-01.ac-cn-hongkong-c.waku.test ansible_host=47.242.250.52 env=waku stage=test data_center=ac-cn-hongkong-c region=cn-hongkong-c dns_entry=node-db-01.ac-cn-hongkong-c.waku.test.status.im
node-db-01.do-ams3.waku.test hostname=node-db-01.do-ams3.waku.test ansible_host=167.99.18.178 env=waku stage=test data_center=do-ams3 region=ams3 dns_entry=node-db-01.do-ams3.waku.test.status.im
node-db-01.gc-us-central1-a.waku.test hostname=node-db-01.gc-us-central1-a.waku.test ansible_host=34.31.46.124 env=waku stage=test data_center=gc-us-central1-a region=us-central1-a dns_entry=node-db-01.gc-us-central1-a.waku.test.status.im
node-01.ac-cn-hongkong-c.waku.test ansible_host=8.218.219.107 data_center=ac-cn-hongkong-c dns_domain=status.im dns_entry=node-01.ac-cn-hongkong-c.waku.test.status.im env=waku region=cn-hongkong-c stage=test
node-01.do-ams3.waku.test ansible_host=178.128.141.171 data_center=do-ams3 dns_domain=status.im dns_entry=node-01.do-ams3.waku.test.status.im env=waku region=ams3 stage=test
node-01.gc-us-central1-a.waku.test ansible_host=34.16.1.67 data_center=gc-us-central1-a dns_entry=node-01.gc-us-central1-a.waku.test.status.im env=waku region=us-central1-a stage=test
node-db-01.ac-cn-hongkong-c.waku.test ansible_host=47.242.250.52 data_center=ac-cn-hongkong-c dns_domain=status.im dns_entry=node-db-01.ac-cn-hongkong-c.waku.test.status.im env=waku region=cn-hongkong-c stage=test
node-db-01.do-ams3.waku.test ansible_host=167.99.18.178 data_center=do-ams3 dns_domain=status.im dns_entry=node-db-01.do-ams3.waku.test.status.im env=waku region=ams3 stage=test
node-db-01.gc-us-central1-a.waku.test ansible_host=34.31.46.124 data_center=gc-us-central1-a dns_entry=node-db-01.gc-us-central1-a.waku.test.status.im env=waku region=us-central1-a stage=test
[ac-cn-hongkong-c]
node-01.ac-cn-hongkong-c.waku.test

View File

@ -413,12 +413,9 @@ def _backup_ansible(inventory):
text += '# For emergency use when Consul fails\n'
text += '[all]\n'
for hostname, host in sorted(inventory.hosts.items()):
text += (
'{0} hostname={0} ansible_host={1} '
).format(hostname, host.host_vars['ansible_host']) + (
'env={env} stage={stage} data_center={data_center} '+
'region={region} dns_entry={dns_entry}\n'
).format(**host.host_vars)
host_vars = {k: v for k, v in host.host_vars.items() if k != 'hostname'}
vars_text = " ".join(f"{k}={v}" for k,v in host_vars.items())
text += f"{hostname} {vars_text}\n"
text += '\n'
for name, hosts in sorted(inventory.groups.items()):
if name in ['_meta', 'all']: