1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/roles/azure_rm_subnet/tasks/main.yml
Matt Clay c27ebfc368 Migrate roles from ansible/azure-testing (#28074)
* Migrate roles from ansible/azure-testing as-is.
* Fix yamllint issues.
* Remove unused binary file.
2017-08-11 16:16:39 -07:00

134 lines
2.8 KiB
YAML

- name: Create resource group
azure_rm_resourcegroup:
name: "{{ resource_group }}"
location: "{{ location }}"
tags:
testing: 'subnet'
delete: 'on-exit'
register: output
- debug: var=output
when: playbook_debug
- name: Create virtual network
azure_rm_virtualnetwork:
name: My_Virtual_Network
address_prefixes_cidr:
- 10.1.0.0/16
- 172.100.0.0/16
dns_servers:
- 127.0.0.1
- 127.0.0.3
tags:
testing: testing
delete: on-exit
resource_group: "{{ resource_group }}"
register: output
- debug: var=output
when: playbook_debug
- name: Remove subnet
azure_rm_subnet:
state: absent
name: foobar
virtual_network_name: My_Virtual_Network
resource_group: "{{ resource_group }}"
register: output
- debug: var=output
when: playbook_debug
- name: Catch invalid cidr
azure_rm_subnet:
name: foobar
virtual_network_name: My_Virtual_Network
resource_group: "{{ resource_group }}"
address_prefix_cidr: "10.1.0/24"
register: output
ignore_errors: yes
- debug: var=output
when: playbook_debug
- assert:
that: output.failed
- name: Add the subnet back
azure_rm_subnet:
name: foobar
virtual_network_name: My_Virtual_Network
resource_group: "{{ resource_group }}"
address_prefix_cidr: "10.1.0.0/24"
register: output
- debug: var=output
when: playbook_debug
- assert:
that: output.changed
- name: Create network security group
azure_rm_securitygroup:
name: secgroupfoo
resource_group: "{{ resource_group }}"
tags:
testing: testing
register: output
- debug: var=output
when: playbook_debug
- name: Update the subnet
azure_rm_subnet:
name: foobar
virtual_network_name: My_Virtual_Network
resource_group: "{{ resource_group }}"
address_prefix_cidr: "10.1.0.0/16"
security_group: secgroupfoo
tags:
testing: testing
delete: on-fini
register: output
- debug: var=output
when: playbook_debug
- name: Should be idempotent
azure_rm_subnet:
name: foobar
virtual_network_name: My_Virtual_Network
resource_group: "{{ resource_group }}"
address_prefix_cidr: "10.1.0.0/16"
security_group: secgroupfoo
tags:
testing: testing
delete: on-fini
register: output
- debug: var=output
when: playbook_debug
- assert:
that: not output.changed
- name: Remove subnet
azure_rm_subnet:
state: absent
name: foobar
virtual_network_name: My_Virtual_Network
resource_group: "{{ resource_group }}"
register: output
- name: Remove security group
azure_rm_securitygroup:
resource_group: "{{ resource_group }}"
name: secgroupfoo
state: absent
- name: Remove virtual network
azure_rm_virtualnetwork:
name: My_Virtual_Network
resource_group: "{{ resource_group }}"
state: absent
register: output