|
12 | 12 | # from ansible_collections.community.sap_libs.plugins.modules.sap_control_exec import choices
|
13 | 13 | # from pygments.lexer import default
|
14 | 14 |
|
15 |
| -DOCUMENTATION = r"""""" |
16 |
| - |
17 |
| -EXAMPLES = r"""""" |
18 |
| - |
19 |
| -RETURN = r"""""" |
| 15 | +DOCUMENTATION = r""" |
| 16 | +module: proxmox_zone |
| 17 | +short_description: Manage Proxmox zone configurations |
| 18 | +description: |
| 19 | + - list/create/update/delete proxmox sdn zones |
| 20 | +author: 'Jana Hoch <[email protected]>' |
| 21 | +options: |
| 22 | + state: |
| 23 | + description: |
| 24 | + - The desired state of the zone configuration. |
| 25 | + type: str |
| 26 | + choices: |
| 27 | + - present |
| 28 | + - absent |
| 29 | + - update |
| 30 | + force: |
| 31 | + description: |
| 32 | + - If state is present and zone exists it'll update. |
| 33 | + - If state is update and zone doesn't exists it'll create new zone |
| 34 | + type: bool |
| 35 | + default: false |
| 36 | + type: |
| 37 | + description: |
| 38 | + - Specify the type of zone. |
| 39 | + type: str |
| 40 | + choices: |
| 41 | + - evpn |
| 42 | + - faucet |
| 43 | + - qinq |
| 44 | + - simple |
| 45 | + - vlan |
| 46 | + - vxlan |
| 47 | + zone: |
| 48 | + description: |
| 49 | + - Unique zone name. |
| 50 | + type: str |
| 51 | + advertise_subnets: |
| 52 | + description: |
| 53 | + - Advertise evpn subnets if you have silent hosts. |
| 54 | + type: bool |
| 55 | + bridge: |
| 56 | + description: |
| 57 | + - Specify the bridge interface to use. |
| 58 | + type: str |
| 59 | + bridge_disable_mac_learning: |
| 60 | + description: |
| 61 | + - Disable auto MAC address learning on the bridge interface. |
| 62 | + type: bool |
| 63 | + controller: |
| 64 | + description: |
| 65 | + - Frr router name. |
| 66 | + type: str |
| 67 | + dhcp: |
| 68 | + description: |
| 69 | + - Type of the DHCP backend for this zone. |
| 70 | + type: str |
| 71 | + choices: |
| 72 | + - dnsmasq |
| 73 | + disable_arp_nd_suppression: |
| 74 | + description: |
| 75 | + - Disable ipv4 arp && ipv6 neighbour discovery suppression. |
| 76 | + type: bool |
| 77 | + dns: |
| 78 | + description: |
| 79 | + - dns api server. |
| 80 | + type: str |
| 81 | + dnszone: |
| 82 | + description: |
| 83 | + - dns domain zone ex: mydomain.com |
| 84 | + type: str |
| 85 | + dp_id: |
| 86 | + description: |
| 87 | + - Faucet dataplane id. |
| 88 | + type: int |
| 89 | + exitnodes: |
| 90 | + description: |
| 91 | + - List of cluster node names. |
| 92 | + type: str |
| 93 | + exitnodes_local_routing: |
| 94 | + description: |
| 95 | + - Allow exitnodes to connect to evpn guests. |
| 96 | + type: bool |
| 97 | + exitnodes_primary: |
| 98 | + description: |
| 99 | + - Force traffic to this exitnode first. |
| 100 | + type: str |
| 101 | + fabric: |
| 102 | + description: |
| 103 | + - SDN fabric to use as underlay for this VXLAN zone. |
| 104 | + type: str |
| 105 | + ipam: |
| 106 | + description: |
| 107 | + - use a specific ipam. |
| 108 | + type: str |
| 109 | + lock_token: |
| 110 | + description: |
| 111 | + - the token for unlocking the global SDN configuration. If not provided it will generate new token |
| 112 | + - If the playbook fails for some reason you can manually clear lock token by deleting `/etc/pve/sdn/.lock` |
| 113 | + type: str |
| 114 | + mac: |
| 115 | + description: |
| 116 | + - Anycast logical router mac address. |
| 117 | + type: str |
| 118 | + mtu: |
| 119 | + description: |
| 120 | + - Set the Maximum Transmission Unit (MTU). |
| 121 | + type: int |
| 122 | + nodes: |
| 123 | + description: |
| 124 | + - List of cluster node names. |
| 125 | + type: str |
| 126 | + peers: |
| 127 | + description: |
| 128 | + - peers address list. |
| 129 | + type: str |
| 130 | + reversedns: |
| 131 | + description: |
| 132 | + - reverse dns api server |
| 133 | + type: str |
| 134 | + rt_import: |
| 135 | + description: |
| 136 | + - Route-Target import. |
| 137 | + type: str |
| 138 | + tag: |
| 139 | + description: |
| 140 | + - Service-VLAN Tag. |
| 141 | + type: int |
| 142 | + vlan_protocol: |
| 143 | + description: |
| 144 | + - Specify the VLAN protocol to use. |
| 145 | + type: str |
| 146 | + choices: |
| 147 | + - 802.1q |
| 148 | + - 802.1ad |
| 149 | + vrf_vxlan: |
| 150 | + description: |
| 151 | + - Specify the VRF VXLAN identifier. |
| 152 | + type: int |
| 153 | + vxlan_port: |
| 154 | + description: |
| 155 | + - Vxlan tunnel udp port (default 4789). |
| 156 | + type: int |
| 157 | +extends_documentation_fragment: |
| 158 | + - community.proxmox.proxmox.actiongroup_proxmox |
| 159 | + - community.proxmox.proxmox.documentation |
| 160 | + - community.proxmox.attributes |
| 161 | +""" |
| 162 | + |
| 163 | +EXAMPLES = r""" |
| 164 | +- name: Get all zones |
| 165 | + community.proxmox.proxmox_zone: |
| 166 | + api_user: "root@pam" |
| 167 | + api_password: "{{ vault.proxmox.root_password }}" |
| 168 | + api_host: "{{ pc.proxmox.api_host }}" |
| 169 | + validate_certs: no |
| 170 | + |
| 171 | +- name: Get all simple zones |
| 172 | + community.proxmox.proxmox_zone: |
| 173 | + api_user: "root@pam" |
| 174 | + api_password: "{{ vault.proxmox.root_password }}" |
| 175 | + api_host: "{{ pc.proxmox.api_host }}" |
| 176 | + validate_certs: no |
| 177 | + type: simple |
| 178 | + register: zones |
| 179 | +
|
| 180 | +- name: create a simple zones |
| 181 | + community.proxmox.proxmox_zone: |
| 182 | + api_user: "root@pam" |
| 183 | + api_password: "{{ vault.proxmox.root_password }}" |
| 184 | + api_host: "{{ pc.proxmox.api_host }}" |
| 185 | + validate_certs: no |
| 186 | + type: simple |
| 187 | + zone: ansible |
| 188 | + state: present |
| 189 | + |
| 190 | +- name: create a vlan zones |
| 191 | + community.proxmox.proxmox_zone: |
| 192 | + api_user: "root@pam" |
| 193 | + api_password: "{{ vault.proxmox.root_password }}" |
| 194 | + api_host: "{{ pc.proxmox.api_host }}" |
| 195 | + validate_certs: no |
| 196 | + type: vlan |
| 197 | + zone: ansible |
| 198 | + state: present |
| 199 | + bridge: vmbr0 |
| 200 | + |
| 201 | +- name: update a zones |
| 202 | + community.proxmox.proxmox_zone: |
| 203 | + api_user: "root@pam" |
| 204 | + api_password: "{{ vault.proxmox.root_password }}" |
| 205 | + api_host: "{{ pc.proxmox.api_host }}" |
| 206 | + validate_certs: no |
| 207 | + type: vlan |
| 208 | + zone: ansible |
| 209 | + state: update |
| 210 | + mtu: 1200 |
| 211 | + |
| 212 | +- name: Delete a zones |
| 213 | + community.proxmox.proxmox_zone: |
| 214 | + api_user: "root@pam" |
| 215 | + api_password: "{{ vault.proxmox.root_password }}" |
| 216 | + api_host: "{{ pc.proxmox.api_host }}" |
| 217 | + validate_certs: no |
| 218 | + type: simple |
| 219 | + zone: ansible |
| 220 | + state: absent |
| 221 | +""" |
| 222 | + |
| 223 | +RETURN = r""" |
| 224 | +zones: |
| 225 | + description: |
| 226 | + - List of zones. if you do not pass zone name. |
| 227 | + - If you are creating/updating/deleting it'll just return a msg with status |
| 228 | + returned: on success |
| 229 | + type: list |
| 230 | + elements: dict |
| 231 | + sample: |
| 232 | + [ |
| 233 | + { |
| 234 | + "digest": "e29dea494461aa699ab3bfb7264d95631c8d0e0d", |
| 235 | + "type": "simple", |
| 236 | + "zone": "ans1" |
| 237 | + }, |
| 238 | + { |
| 239 | + "bridge": "vmbr0", |
| 240 | + "digest": "e29dea494461aa699ab3bfb7264d95631c8d0e0d", |
| 241 | + "mtu": 1200, |
| 242 | + "type": "vlan", |
| 243 | + "zone": "ansible" |
| 244 | + }, |
| 245 | + { |
| 246 | + "bridge": "vmbr100", |
| 247 | + "digest": "e29dea494461aa699ab3bfb7264d95631c8d0e0d", |
| 248 | + "ipam": "pve", |
| 249 | + "type": "vlan", |
| 250 | + "zone": "lab" |
| 251 | + }, |
| 252 | + { |
| 253 | + "dhcp": "dnsmasq", |
| 254 | + "digest": "e29dea494461aa699ab3bfb7264d95631c8d0e0d", |
| 255 | + "ipam": "pve", |
| 256 | + "type": "simple", |
| 257 | + "zone": "test1" |
| 258 | + }, |
| 259 | + { |
| 260 | + "digest": "e29dea494461aa699ab3bfb7264d95631c8d0e0d", |
| 261 | + "ipam": "pve", |
| 262 | + "type": "simple", |
| 263 | + "zone": "tsjsfv" |
| 264 | + } |
| 265 | + ] |
| 266 | + |
| 267 | +""" |
20 | 268 |
|
21 | 269 | from ansible.module_utils.basic import AnsibleModule
|
22 | 270 | from ansible_collections.community.proxmox.plugins.module_utils.proxmox import (
|
|
0 commit comments