I'm trying to figure out how to use <https://cloud...
# python
i
I'm trying to figure out how to use https://cloudinit.readthedocs.io/en/latest/topics/modules.html#set-hostname (with OpenStack). As I understand it, I need to pass
user_data
as follows:
Copy code
#cloud-config
fqdn: host.name.goes.here
which is simple enough... But I want to create multiple machines, and I have considerably more in
user_data
. So far I'm defining
PROVISION
which holds the string with a bunch of data, with the intention of using it in mine
Copy code
INSTANCES = {
  i: openstack.compute.Instance(f'instance-{i + 1}.test.instance',
                                flavor_name="1C-1G-20G",
                                image_name="Debian-Buster-amd64",
                                key_pair="my_key",
                                networks=[{
                                  'name': 'test-net',
                                  'accessNetwork': 'true'
                                }],
                                user_data=PROVISION,
                                security_groups=SECGROUPS_TEST)
  for i in range(INSTANCE_COUNT)
  }
Any suggestions how I can set / inject / template in
PROVISION
passed here
fqdn: instance-{i + 1}.test.instance
?