-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__main__.py
More file actions
67 lines (58 loc) · 1.82 KB
/
__main__.py
File metadata and controls
67 lines (58 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""An OpenStack Python Pulumi program"""
import pulumi
from pulumi_openstack import images
from pulumi_openstack import compute
from pulumi_openstack import networking
from pulumi_openstack import blockstorage
lan_net = networking.Network("nodes-net", admin_state_up=True)
subnet = networking.Subnet(
"nodes-subnet",
network_id=lan_net.id,
cidr="192.168.99.0/24",
ip_version=4,
dns_nameservers=["1.1.1.1", "9.9.9.9"],
)
router = networking.Router(
"nodes-router",
admin_state_up=True,
external_network_id="0f9c3806-bd21-490f-918d-4a6d1c648489",
)
networking.RouterInterface(
"routerInterface", router_id=router.id, subnet_id=subnet.id
)
node_secgroup = networking.SecGroup(
"node_secgroup", description="My neutron security group"
)
networking.SecGroupRule(
"ingress-allow-everything",
direction="ingress",
ethertype="IPv4",
remote_ip_prefix="0.0.0.0/0",
security_group_id=node_secgroup.id,
)
talos_image = images.Image("talos-image",
local_file_path="talos-omni-v1.7.4.iso",
container_format="bare",
decompress=True,
disk_format="iso",
name="talos-omni",
visibility="private")
for node in ["node-1", "node-2", "node-3"]:
instance_worker = compute.Instance(
node,
flavor_name="a1-ram2-disk20-perf1",
image_name=talos_image.name,
networks=[{"name": lan_net.name}],
security_groups=[node_secgroup.name],
)
volume = blockstorage.Volume(node, size=50, name=node)
compute.VolumeAttach(node,
instance_id=instance_worker.id,
volume_id=volume.id)
# floating_ip_admin = compute.FloatingIp(node, pool="ext-floating1")
# compute.FloatingIpAssociate(
# f"floating-ip-{node}",
# floating_ip=floating_ip_admin.address,
# instance_id=instance_worker.id,
# fixed_ip=instance_worker.networks[0].fixed_ip_v4,
# )