community.proxmox.proxmox_subnet module – Create/Update/Delete subnets from SDN
Note
This module is part of the community.proxmox collection (version 1.6.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.proxmox. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: community.proxmox.proxmox_subnet.
New in community.proxmox 1.4.0
Synopsis
- Create, update, or delete subnets in Proxmox SDN.
Requirements
The below requirements are needed on the host that executes this module.
- proxmoxer >= 2.0
- requests
Parameters
Parameter | Comments |
|---|---|
api_host string / required | Specify the target host of the Proxmox VE cluster. Uses the |
api_password string | Specify the password to authenticate with. Uses the |
api_port integer | Specify the target port of the Proxmox VE cluster. Uses the |
api_timeout integer | Time limit for requests towards the Proxmox VE API. Default: |
api_token_id string | Specify the token ID. Uses the |
api_token_secret string | Specify the token secret. Uses the |
api_user string / required | Specify the user to authenticate with. Uses the |
ca_path path | Path to a local certificate, which will be used to verify TLS connections. Ignored if |
delete string | A list of settings you want to delete. |
dhcp_dns_server string | IP address for the DNS server. |
dhcp_range list / elements=dictionary | Range of IP addresses for DHCP. |
|
end string / required |
Ending IP address of the DHCP range. |
|
start string / required |
Starting IP address of the DHCP range. |
dhcp_range_update_mode string | Only applicable for If set to append and new dhcp_range passed it will just append to existing ranges. And If no dhcp_range passed and there are existing ranges it will just ignore existing ranges and only update other params if needed If set to overwrite and new dhcp_range passed it will overwrite existing ranges. If no dhcp_range passed and there are existing ranges it will delete all dhcp_ranges Choices:
|
dnszoneprefix string | Prefix for the DNS zone. |
gateway string | Subnet Gateway. Will be assign on vnet for layer3 zones. |
lock_token string | the token for unlocking the global SDN configuration. |
snat boolean | Enable Source NAT for the subnet. Choices:
|
state string | Desired state of the subnet configuration. Choices:
|
subnet string / required | Subnet CIDR. |
update boolean | |
validate_certs boolean | Validate the TLS certificates used for the connection to the Proxmox VE API. Currently defaults to Uses the Choices:
|
vnet string / required | The virtual network to which the subnet belongs. |
zone string | Vnet Zone. |
Attributes
Attribute | Support | Description |
|---|---|---|
action_group | Action group: community.proxmox.proxmox | Use |
check_mode | Support: none | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
Examples
- name: Create a subnet
community.proxmox.proxmox_subnet:
api_user: "{{ pc.proxmox.api_user }}"
api_token_id: "{{ pc.proxmox.api_token_id }}"
api_token_secret: "{{ vault.proxmox.api_token_secret }}"
api_host: "{{ pc.proxmox.api_host }}"
validate_certs: false
vnet: test
subnet: 10.10.2.0/24
zone: ans1
state: present
dhcp_range:
- start: 10.10.2.5
end: 10.10.2.50
- start: 10.10.2.100
end: 10.10.2.150
snat: true
- name: Delete a subnet
community.proxmox.proxmox_subnet:
api_user: "{{ pc.proxmox.api_user }}"
api_token_id: "{{ pc.proxmox.api_token_id }}"
api_token_secret: "{{ vault.proxmox.api_token_secret }}"
api_host: "{{ pc.proxmox.api_host }}"
validate_certs: false
vnet: test
subnet: 10.10.2.0/24
zone: ans1
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
subnet string | Subnet ID which was created/updated/deleted Returned: on success Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/community/proxmox/proxmox_subnet_module.html