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/targets/cs_ip_address/tasks/network.yml
René Moser 242bd512d0
cs_ip_address: fix vpc and network mutually exclusive (#47846)
* cs_ip_address: fix vpc and network mutually exclusive

* add changelog

* streamline docs
2018-11-01 07:26:08 +01:00

212 lines
5.9 KiB
YAML

---
- name: setup ensure the test network is absent
cs_network:
name: ipaddr_test_network
state: absent
zone: "{{ cs_common_zone_adv }}"
- name: setup create the test network
cs_network:
name: ipaddr_test_network
network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService
state: present
zone: "{{ cs_common_zone_adv }}"
register: base_network
- name: setup verify create the test network
assert:
that:
- base_network is successful
- name: setup clean ip_address with tags
cs_ip_address:
state: absent
tags:
- key: unique_id
value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
- name: setup associate ip_address for SNAT
cs_ip_address:
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
register: ip_address_snat
- name: test associate ip_address in check mode
cs_ip_address:
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
check_mode: true
register: ip_address
- name: verify test associate ip_address in check mode
assert:
that:
- ip_address is successful
- ip_address is changed
- name: test associate ip_address
cs_ip_address:
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
register: ip_address
- name: verify test associate ip_address
assert:
that:
- ip_address is successful
- ip_address is changed
- ip_address.ip_address is defined
- name: test associate ip_address with tags in check mode
cs_ip_address:
network: ipaddr_test_network
tags:
- key: unique_id
value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
zone: "{{ cs_common_zone_adv }}"
register: ip_address_tag
check_mode: true
- name: verify test associate ip_address with tags in check mode
assert:
that:
- ip_address_tag is successful
- ip_address_tag is changed
- name: test associate ip_address with tags
cs_ip_address:
network: ipaddr_test_network
tags:
- key: unique_id
value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
zone: "{{ cs_common_zone_adv }}"
register: ip_address_tag
- name: verify test associate ip_address with tags
assert:
that:
- ip_address_tag is successful
- ip_address_tag is changed
- ip_address_tag.ip_address is defined
- ip_address_tag.tags.0.key == "unique_id"
- ip_address_tag.tags.0.value == "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
- name: test associate ip_address with tags idempotence
cs_ip_address:
network: ipaddr_test_network
tags:
- key: unique_id
value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
zone: "{{ cs_common_zone_adv }}"
register: ip_address_tag
- name: verify test associate ip_address with tags idempotence
assert:
that:
- ip_address_tag is successful
- ip_address_tag is not changed
- ip_address_tag.ip_address is defined
- ip_address_tag.state == "Allocated"
- ip_address_tag.tags.0.key == "unique_id"
- ip_address_tag.tags.0.value == "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
- name: test disassiociate ip_address with missing param ip_address
cs_ip_address:
state: absent
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
ignore_errors: true
register: ip_address_err
- name: verify test disassiociate ip_address with missing param ip_address
assert:
that:
- ip_address_err is failed
- 'ip_address_err.msg == "state is absent but any of the following are missing: ip_address, tags"'
- name: test disassociate ip_address in check mode
cs_ip_address:
state: absent
ip_address: "{{ ip_address.ip_address }}"
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
check_mode: true
register: ip_address
- name: verify test disassociate ip_address in check mode
assert:
that:
- ip_address is successful
- ip_address is changed
- name: test disassociate ip_address
cs_ip_address:
state: absent
ip_address: "{{ ip_address.ip_address }}"
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
register: ip_address
- name: verify test disassociate ip_address
assert:
that:
- ip_address is successful
- ip_address is changed
- name: test disassociate ip_address idempotence
cs_ip_address:
state: absent
ip_address: "{{ ip_address.ip_address }}"
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
register: ip_address
- name: verify test disassociate ip_address idempotence
assert:
that:
- ip_address is successful
- ip_address is not changed
- name: test disassociate ip_address with tags with check mode
cs_ip_address:
state: absent
tags:
- key: unique_id
value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
check_mode: true
register: ip_address
- name: verify test disassociate ip_address with tags in check mode
assert:
that:
- ip_address is successful
- ip_address is changed
- name: test disassociate ip_address with tags
cs_ip_address:
state: absent
tags:
- key: unique_id
value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
register: ip_address
- name: verify test disassociate ip_address with tags
assert:
that:
- ip_address is successful
- ip_address is changed
- name: test disassociate ip_address with tags idempotence
cs_ip_address:
state: absent
tags:
- key: unique_id
value: "adacd65e-7868-5ebf-9f8b-e6e0ea779861"
network: ipaddr_test_network
zone: "{{ cs_common_zone_adv }}"
register: ip_address
- name: verify test disassociate ip_address with tags idempotence
assert:
that:
- ip_address is successful
- ip_address is not changed
- name: clean the test network
cs_network:
name: ipaddr_test_network
state: absent
zone: "{{ cs_common_zone_adv }}"