| 1 |
--- |
| 2 |
- name: Create network in check mode |
| 3 |
cloudscale_ch.cloud.network: |
| 4 |
name: '{{ cloudscale_resource_prefix }}-net' |
| 5 |
tags: |
| 6 |
project: ansible-test |
| 7 |
stage: production |
| 8 |
sla: 24-7 |
| 9 |
register: net |
| 10 |
check_mode: yes |
| 11 |
- name: 'VERIFY: Create network in check mode' |
| 12 |
assert: |
| 13 |
that: |
| 14 |
- net is changed |
| 15 |
- net.name == cloudscale_resource_prefix + '-net' |
| 16 |
- not net.uuid |
| 17 |
|
| 18 |
- name: Create network |
| 19 |
cloudscale_ch.cloud.network: |
| 20 |
name: '{{ cloudscale_resource_prefix }}-net' |
| 21 |
zone: '{{ cloudscale_test_zone }}' |
| 22 |
tags: |
| 23 |
project: ansible-test |
| 24 |
stage: production |
| 25 |
sla: 24-7 |
| 26 |
register: net |
| 27 |
- name: 'VERIFY: Create network' |
| 28 |
assert: |
| 29 |
that: |
| 30 |
- net is changed |
| 31 |
- net.mtu == 9000 |
| 32 |
- net.name == cloudscale_resource_prefix + '-net' |
| 33 |
- net.zone.slug == cloudscale_test_zone |
| 34 |
- net.uuid is defined |
| 35 |
- net.tags.project == 'ansible-test' |
| 36 |
- net.tags.stage == 'production' |
| 37 |
- net.tags.sla == '24-7' |
| 38 |
|
| 39 |
- name: Remember uuid |
| 40 |
set_fact: |
| 41 |
network_uuid: '{{ net.uuid }}' |
| 42 |
|
| 43 |
- name: Create network idempotence |
| 44 |
cloudscale_ch.cloud.network: |
| 45 |
name: '{{ cloudscale_resource_prefix }}-net' |
| 46 |
zone: '{{ cloudscale_test_zone }}' |
| 47 |
tags: |
| 48 |
project: ansible-test |
| 49 |
stage: production |
| 50 |
sla: 24-7 |
| 51 |
register: net |
| 52 |
- name: 'VERIFY: Create network idempotence' |
| 53 |
assert: |
| 54 |
that: |
| 55 |
- net is not changed |
| 56 |
- net.name == cloudscale_resource_prefix + '-net' |
| 57 |
- net.zone.slug == cloudscale_test_zone |
| 58 |
- net.uuid == network_uuid |
| 59 |
- net.tags.project == 'ansible-test' |
| 60 |
- net.tags.stage == 'production' |
| 61 |
- net.tags.sla == '24-7' |
| 62 |
|
| 63 |
- name: Update network in check mode |
| 64 |
cloudscale_ch.cloud.network: |
| 65 |
uuid: '{{ network_uuid }}' |
| 66 |
name: '{{ cloudscale_resource_prefix }}-net2' |
| 67 |
tags: |
| 68 |
project: ansible-test |
| 69 |
stage: staging |
| 70 |
sla: 8-5 |
| 71 |
register: net |
| 72 |
check_mode: yes |
| 73 |
- name: 'VERIFY: Update network in check mode' |
| 74 |
assert: |
| 75 |
that: |
| 76 |
- net is changed |
| 77 |
- net.name == cloudscale_resource_prefix + '-net' |
| 78 |
- net.uuid == network_uuid |
| 79 |
- net.zone.slug == cloudscale_test_zone |
| 80 |
- net.tags.project == 'ansible-test' |
| 81 |
- net.tags.stage == 'production' |
| 82 |
- net.tags.sla == '24-7' |
| 83 |
|
| 84 |
- name: Update network |
| 85 |
cloudscale_ch.cloud.network: |
| 86 |
uuid: '{{ network_uuid }}' |
| 87 |
name: '{{ cloudscale_resource_prefix }}-net2' |
| 88 |
tags: |
| 89 |
project: ansible-test |
| 90 |
stage: staging |
| 91 |
sla: 8-5 |
| 92 |
register: net |
| 93 |
- name: 'VERIFY: Update network' |
| 94 |
assert: |
| 95 |
that: |
| 96 |
- net is changed |
| 97 |
- net.name == cloudscale_resource_prefix + '-net2' |
| 98 |
- net.uuid == network_uuid |
| 99 |
- net.zone.slug == cloudscale_test_zone |
| 100 |
- net.tags.project == 'ansible-test' |
| 101 |
- net.tags.stage == 'staging' |
| 102 |
- net.tags.sla == '8-5' |
| 103 |
|
| 104 |
- name: Update network idempotence |
| 105 |
cloudscale_ch.cloud.network: |
| 106 |
uuid: '{{ network_uuid }}' |
| 107 |
name: '{{ cloudscale_resource_prefix }}-net2' |
| 108 |
tags: |
| 109 |
project: ansible-test |
| 110 |
stage: staging |
| 111 |
sla: 8-5 |
| 112 |
register: net |
| 113 |
- name: 'VERIFY: Update network idempotence' |
| 114 |
assert: |
| 115 |
that: |
| 116 |
- net is not changed |
| 117 |
- net.name == cloudscale_resource_prefix + '-net2' |
| 118 |
- net.uuid == network_uuid |
| 119 |
- net.zone.slug == cloudscale_test_zone |
| 120 |
- net.tags.project == 'ansible-test' |
| 121 |
- net.tags.stage == 'staging' |
| 122 |
- net.tags.sla == '8-5' |
| 123 |
|
| 124 |
- name: Delete network in check mode |
| 125 |
cloudscale_ch.cloud.network: |
| 126 |
name: '{{ cloudscale_resource_prefix }}-net2' |
| 127 |
state: absent |
| 128 |
register: net |
| 129 |
check_mode: yes |
| 130 |
- name: 'VERIFY: Delete network in check mode' |
| 131 |
assert: |
| 132 |
that: |
| 133 |
- net is changed |
| 134 |
- net.name == cloudscale_resource_prefix + '-net2' |
| 135 |
- net.uuid == network_uuid |
| 136 |
|
| 137 |
- name: Delete network |
| 138 |
cloudscale_ch.cloud.network: |
| 139 |
name: '{{ cloudscale_resource_prefix }}-net2' |
| 140 |
state: absent |
| 141 |
register: net |
| 142 |
- name: 'VERIFY: Delete network' |
| 143 |
assert: |
| 144 |
that: |
| 145 |
- net is changed |
| 146 |
- net.name == cloudscale_resource_prefix + '-net2' |
| 147 |
- net.uuid == network_uuid |
| 148 |
|
| 149 |
- name: Delete network idempotence |
| 150 |
cloudscale_ch.cloud.network: |
| 151 |
name: '{{ cloudscale_resource_prefix }}-net2' |
| 152 |
state: absent |
| 153 |
register: net |
| 154 |
- name: 'VERIFY: Delete network idempotence' |
| 155 |
assert: |
| 156 |
that: |
| 157 |
- net is not changed |
| 158 |
- net.name == cloudscale_resource_prefix + '-net2' |
| 159 |
- not net.uuid |