opentelekomcloud.vpc
VPC Role for Open Telekom Cloud
This is an Ansible role for creating a VPC (Virtual Private Cloud) in the Open Telekom Cloud, including a network and a subnet.
What is a VPC?
A VPC is a separate virtual network in the Open Telekom Cloud. It includes a range of IP addresses that can be divided into smaller groups (subnets) and connected via a router to other networks, such as the Internet. You can create multiple VPCs within one domain or project.
Requirements
To use this role, you need to have the
openstacksdk
installed on the machine where you run the commands. You also need valid login details for the Open Telekom Cloud. This role works with any version of Ansible, but if the openstacksdk
version is older than 0.15, the enable_snat
feature will be turned off and cannot be turned back on using Ansible (only via CLI or UI).
Installation
You can install this role from Ansible Galaxy with the command:
ansible-galaxy install opentelekomcloud.vpc
Role Variables
The following variables are available, along with their default values (see defaults/main.yml
):
# Prefix for naming resources
prefix: test-
# Router name to be used:
router_name: "{{ (prefix + router_name_suffix) }}"
# Network name:
network_name: "{{ (prefix + network_name_suffix) }}"
# Subnet name:
subnet_name: "{{ (prefix + subnet_name_suffix) }}"
# Default CIDR for the subnet
subnet_cidr: "192.168.110.0/24"
# Default DNS servers:
subnet_dns_servers: "{{ ['100.125.4.25', '8.8.8.8'] }}"
# State: `present` for creation, `absent` for deletion
state: present
Example Playbook
Here's an example of how to use this role (with variable values provided):
- hosts: localhost
roles:
- opentelekomcloud.vpc
To delete the VPC, you only need to change the state variable to 'absent':
- hosts: localhost
roles:
- { role: opentelekomcloud.vpc, state: 'absent' }
Here’s an example that shows how to use different variables:
- hosts: localhost
vars:
router_name: 'my_router'
network_name: 'my_network'
subnet_name: 'my_subnet'
subnet_cidr: '192.168.1.0/24'
subnet_dns_servers: "['100.125.4.25', '8.8.4.4']"
enable_snat: false
roles:
- { role: opentelekomcloud.vpc, state: 'present' }
License
Apache
Author Information
Ecosystem Team at Open Telekom Cloud TBD@telekom.com
Manage a router with net and subnet (VPC in OTC terms)
ansible-galaxy install opentelekomcloud.vpc