def _provision_private_networks(self):
     private_networks = {}
     for props in self.props.private_networks:
         network = networking.Network("private-network-" + props["name"])
         subnet = networking.Subnet(
             "subnet-" + props["name"],
             network_id=network.id,
             cidr=props["cidr"],
             ip_version=4,
             opts=ResourceOptions(delete_before_replace=True),
         )
         networking.RouterInterface(
             "router-interface-" + props["name"],
             router_id=self.resources.private_router.id,
             subnet_id=subnet.id,
             opts=ResourceOptions(delete_before_replace=True),
         )
         private_networks[props["name"]] = {
             "network": network,
             "subnet": subnet,
             "vlan_id": props["vlan_id"],
         }
     return private_networks
Exemple #2
0
package_update: true
package_upgrade: true
manage_etc_hosts: true
users:
  - default
  - name: ubuntu
    ssh-authorized-keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8TymxWTJSmirXaZKdFebz2vRpKWQD881XpqceMEpTJ/i46sR4rRwFOlYR19Zpr8dyMjkZ/hxWGVG60vKKFKcqzoTJ/aTbfSF4FUyVlb84XEig+9w1LZ7kTmrX4qRQZIuf6b21FOOaLrF+xcGSnbidQ8aKzEAFv1jxWHV7jTE/Np/ne2Ir2CdH7Qq9bz680mArBK/L056GY+4rwUNINW2YiZT+5qP3nOKHW7JYXovOdZyZIAKUmb8/O7EK6GxPyUh5DkkL1z9tcgQ/ZB0XM9h4igcvPJkRyqXpN1Tdm36aByF2gkXxpdpSLYsMKMHcYGE4zVanhKCi1ucenWFn0t/z Generated-by-Nova 
"""

# create a key we use later on
key = compute.Keypair("ssh-key", name="ssh-key")

# create a network
galaxy_net = networking.Network("galaxy-net", name="galaxy-net")
galaxy_subnet = networking.Subnet(
    "galaxy-subnet",
    name="galaxy-subnet",
    cidr="192.168.199.0/24",
    ip_version=4,
    network_id=galaxy_net.id,
)

# create our router
router = networking.Router("router",
                           admin_state_up=True,
                           external_network_id=EXT_NET)
interface = networking.RouterInterface("interface",
                                       router_id=router.id,
                                       subnet_id=galaxy_subnet.id)