community / community.digitalocean / 1.26.0 / module / digital_ocean_vpc Create and delete DigitalOcean VPCs | "added in version" 1.7.0 of community.digitalocean" Authors: Mark Mercado (@mamercad)community.digitalocean.digital_ocean_vpc (1.26.0) — module
Install with ansible-galaxy collection install community.digitalocean:==1.26.0
collections: - name: community.digitalocean version: 1.26.0
This module can be used to create and delete DigitalOcean VPCs.
- name: Create a VPC community.digitalocean.digital_ocean_vpc: state: present name: myvpc1 region: nyc1
- name: Create a VPC (choose IP range) community.digitalocean.digital_ocean_vpc: state: present name: myvpc1 region: nyc1 ip_range: 192.168.192.0/24
- name: Update a VPC (make it default) community.digitalocean.digital_ocean_vpc: state: present name: myvpc1 region: nyc1 default: true
- name: Update a VPC (change description) community.digitalocean.digital_ocean_vpc: state: present name: myvpc1 region: nyc1 description: myvpc
- name: Delete a VPC community.digitalocean.digital_ocean_vpc: state: absent name: myvpc1
name: description: - The name of the VPC. - Must be unique and contain alphanumeric characters, dashes, and periods only. required: true type: str state: choices: - present - absent default: present description: - Whether the VPC should be present (created) or absent (deleted). type: str region: description: - The slug identifier for the region where the VPC will be created. type: str baseurl: default: https://api.digitalocean.com/v2 description: - DigitalOcean API base url. type: str default: default: false description: - A boolean value indicating whether or not the VPC is the default network for the region. - All applicable resources are placed into the default VPC network unless otherwise specified during their creation. - The C(default) field cannot be unset from C(true). - If you want to set a new default VPC network, update the C(default) field of another VPC network in the same region. - The previous network's C(default) field will be set to C(false) when a new default VPC has been defined. type: bool timeout: default: 30 description: - The timeout in seconds used for polling DigitalOcean's API. type: int ip_range: description: - The requested range of IP addresses for the VPC in CIDR notation. - Network ranges cannot overlap with other networks in the same account and must be in range of private addresses as defined in RFC1918. - It may not be smaller than /24 nor larger than /16. - If no IP range is specified, a /20 network range is generated that won't conflict with other VPC networks in your account. type: str description: description: - A free-form text field for describing the VPC's purpose. - It may be a maximum of 255 characters. type: str oauth_token: aliases: - api_token description: - DigitalOcean OAuth token. - There are several other environment variables which can be used to provide this value. - i.e., - C(DO_API_TOKEN), C(DO_API_KEY), C(DO_OAUTH_TOKEN) and C(OAUTH_TOKEN). type: str validate_certs: default: true description: - If set to C(no), the SSL certificates will not be validated. - This should only set to C(no) used on personally controlled sites using self-signed certificates. type: bool
data: description: A DigitalOcean VPC. returned: success sample: msg: Created VPC myvpc1 in nyc1 vpc: created_at: '2021-06-17T11:43:12.12121565Z' default: false description: '' id: a3b72d97-192f-4984-9d71-08a5faf2e0c7 ip_range: 10.116.16.0/20 name: testvpc1 region: nyc1 urn: do:vpc:a3b72d97-192f-4984-9d71-08a5faf2e0c7 type: dict