|
|
@ -1,28 +1,12 @@
|
|
|
|
|
|
|
|
# FIXME: needs minimal tests (check mode?) that can run quickly, VNG creation takes > 20min
|
|
|
|
|
|
|
|
|
|
|
|
- name: Prepare random number
|
|
|
|
- name: Prepare random number
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
vnetname: "vnet{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
|
|
|
|
vnetname: "vnet{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
|
|
|
|
vngname: "vng{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
|
|
|
|
vngname: "vng{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create virtual network
|
|
|
|
- name: Create virtual network gateway without bgp settings (check mode)
|
|
|
|
azure_rm_virtualnetwork:
|
|
|
|
check_mode: yes
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
|
|
|
|
name: "{{ vnetname }}"
|
|
|
|
|
|
|
|
address_prefixes: "10.0.0.0/16"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Add subnet
|
|
|
|
|
|
|
|
azure_rm_subnet:
|
|
|
|
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
|
|
|
|
name: GatewaySubnet
|
|
|
|
|
|
|
|
address_prefix: "10.0.2.0/24"
|
|
|
|
|
|
|
|
virtual_network: "{{ vnetname }}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create public IP address
|
|
|
|
|
|
|
|
azure_rm_publicipaddress:
|
|
|
|
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
|
|
|
|
allocation_method: Dynamic
|
|
|
|
|
|
|
|
name: testPublicIP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create virtual network gateway without bgp settings
|
|
|
|
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
name: "{{ vngname }}"
|
|
|
@ -38,45 +22,99 @@
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that: output.changed
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create virtual network gateway without bgp settings - idempotent
|
|
|
|
- name: long-running virtualnetworkgateway tests [run with `--tags long_run,untagged` to enable]
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
tags: [long_run, never]
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
block:
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
- name: Create virtual network
|
|
|
|
ip_configurations:
|
|
|
|
azure_rm_virtualnetwork:
|
|
|
|
- name: testipconfig
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
private_ip_allocation_method: Dynamic
|
|
|
|
name: "{{ vnetname }}"
|
|
|
|
public_ip_address_name: testPublicIP
|
|
|
|
address_prefixes: "10.0.0.0/16"
|
|
|
|
virtual_network: "{{ vnetname }}"
|
|
|
|
|
|
|
|
tags:
|
|
|
|
|
|
|
|
common: "xyz"
|
|
|
|
|
|
|
|
register: output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- name: Add subnet
|
|
|
|
that: not output.changed
|
|
|
|
azure_rm_subnet:
|
|
|
|
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
|
|
|
|
name: GatewaySubnet
|
|
|
|
|
|
|
|
address_prefix: "10.0.2.0/24"
|
|
|
|
|
|
|
|
virtual_network: "{{ vnetname }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Update virtual network gateway
|
|
|
|
- name: Create public IP address
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
azure_rm_publicipaddress:
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
allocation_method: Dynamic
|
|
|
|
ip_configurations:
|
|
|
|
name: testPublicIP
|
|
|
|
- name: testipconfig
|
|
|
|
|
|
|
|
private_ip_allocation_method: Dynamic
|
|
|
|
|
|
|
|
public_ip_address_name: testPublicIP
|
|
|
|
|
|
|
|
virtual_network: "{{ vnetname }}"
|
|
|
|
|
|
|
|
tags:
|
|
|
|
|
|
|
|
common: "mno"
|
|
|
|
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Delete virtual network gateway
|
|
|
|
- name: Create virtual network gateway without bgp settings
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
state: absent
|
|
|
|
ip_configurations:
|
|
|
|
register: output
|
|
|
|
- name: testipconfig
|
|
|
|
- assert:
|
|
|
|
private_ip_allocation_method: Dynamic
|
|
|
|
that: output.changed
|
|
|
|
public_ip_address_name: testPublicIP
|
|
|
|
|
|
|
|
virtual_network: "{{ vnetname }}"
|
|
|
|
|
|
|
|
tags:
|
|
|
|
|
|
|
|
common: "xyz"
|
|
|
|
|
|
|
|
register: output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create virtual network gateway without bgp settings
|
|
|
|
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
|
|
|
|
ip_configurations:
|
|
|
|
|
|
|
|
- name: testipconfig
|
|
|
|
|
|
|
|
private_ip_allocation_method: Dynamic
|
|
|
|
|
|
|
|
public_ip_address_name: testPublicIP
|
|
|
|
|
|
|
|
virtual_network: "{{ vnetname }}"
|
|
|
|
|
|
|
|
tags:
|
|
|
|
|
|
|
|
common: "xyz"
|
|
|
|
|
|
|
|
register: output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create virtual network gateway without bgp settings - idempotent
|
|
|
|
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
|
|
|
|
ip_configurations:
|
|
|
|
|
|
|
|
- name: testipconfig
|
|
|
|
|
|
|
|
private_ip_allocation_method: Dynamic
|
|
|
|
|
|
|
|
public_ip_address_name: testPublicIP
|
|
|
|
|
|
|
|
virtual_network: "{{ vnetname }}"
|
|
|
|
|
|
|
|
tags:
|
|
|
|
|
|
|
|
common: "xyz"
|
|
|
|
|
|
|
|
register: output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
|
|
|
|
that: not output.changed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Update virtual network gateway
|
|
|
|
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
|
|
|
|
ip_configurations:
|
|
|
|
|
|
|
|
- name: testipconfig
|
|
|
|
|
|
|
|
private_ip_allocation_method: Dynamic
|
|
|
|
|
|
|
|
public_ip_address_name: testPublicIP
|
|
|
|
|
|
|
|
virtual_network: "{{ vnetname }}"
|
|
|
|
|
|
|
|
tags:
|
|
|
|
|
|
|
|
common: "mno"
|
|
|
|
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Delete virtual network gateway
|
|
|
|
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
|
|
|
|
name: "{{ vngname }}"
|
|
|
|
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
|
|
|
|
that: output.changed
|
|
|
|
|
|
|
|
|
|
|
|
- name: Delete virtual network gateway - idempotent
|
|
|
|
- name: Delete virtual network gateway - idempotent
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|
azure_rm_virtualnetworkgateway:
|
|
|
|