| 1 |
--- |
| 2 |
# Create LB |
| 3 |
- name: Test create a running load balancer in check mode |
| 4 |
cloudscale_ch.cloud.load_balancer: |
| 5 |
name: '{{ cloudscale_resource_prefix }}-test' |
| 6 |
flavor: '{{ cloudscale_test_flavor_lb }}' |
| 7 |
vip_addresses: |
| 8 |
- subnet: '{{ snet.uuid }}' |
| 9 |
zone: '{{ cloudscale_test_zone }}' |
| 10 |
tags: |
| 11 |
project: ansible-test |
| 12 |
stage: production |
| 13 |
sla: 24-7 |
| 14 |
register: load_balancer |
| 15 |
check_mode: yes |
| 16 |
- name: Verify create a load balancer in check mode |
| 17 |
assert: |
| 18 |
that: |
| 19 |
- load_balancer is changed |
| 20 |
- load_balancer.state == 'absent' |
| 21 |
|
| 22 |
- name: Test create a running load balancer |
| 23 |
cloudscale_ch.cloud.load_balancer: |
| 24 |
name: '{{ cloudscale_resource_prefix }}-test' |
| 25 |
flavor: '{{ cloudscale_test_flavor_lb }}' |
| 26 |
vip_addresses: |
| 27 |
- subnet: '{{ snet.uuid }}' |
| 28 |
zone: '{{ cloudscale_test_zone }}' |
| 29 |
tags: |
| 30 |
project: ansible-test |
| 31 |
stage: production |
| 32 |
sla: 24-7 |
| 33 |
register: load_balancer |
| 34 |
- name: Verify create a running load balancer |
| 35 |
assert: |
| 36 |
that: |
| 37 |
- load_balancer is changed |
| 38 |
- load_balancer.status == 'running' |
| 39 |
- load_balancer.name == cloudscale_resource_prefix + '-test' |
| 40 |
- load_balancer.flavor.slug == cloudscale_test_flavor_lb |
| 41 |
- load_balancer.vip_addresses[0].subnet.uuid == snet.uuid |
| 42 |
- load_balancer.zone.slug == cloudscale_test_zone |
| 43 |
- load_balancer.tags.project == 'ansible-test' |
| 44 |
- load_balancer.tags.stage == 'production' |
| 45 |
- load_balancer.tags.sla == '24-7' |
| 46 |
|
| 47 |
- name: Test create a running load balancer idempotence |
| 48 |
cloudscale_ch.cloud.load_balancer: |
| 49 |
name: '{{ cloudscale_resource_prefix }}-test' |
| 50 |
flavor: '{{ cloudscale_test_flavor_lb }}' |
| 51 |
vip_addresses: |
| 52 |
- subnet: '{{ snet.uuid }}' |
| 53 |
zone: '{{ cloudscale_test_zone }}' |
| 54 |
tags: |
| 55 |
project: ansible-test |
| 56 |
stage: production |
| 57 |
sla: 24-7 |
| 58 |
register: load_balancer |
| 59 |
- name: Verify create a running load balancer idempotence |
| 60 |
assert: |
| 61 |
that: |
| 62 |
- load_balancer is not changed |
| 63 |
- load_balancer.status == 'running' |
| 64 |
- load_balancer.name == cloudscale_resource_prefix + '-test' |
| 65 |
- load_balancer.flavor.slug == cloudscale_test_flavor_lb |
| 66 |
- load_balancer.vip_addresses[0].subnet.uuid == snet.uuid |
| 67 |
- load_balancer.zone.slug == cloudscale_test_zone |
| 68 |
- load_balancer.tags.project == 'ansible-test' |
| 69 |
- load_balancer.tags.stage == 'production' |
| 70 |
- load_balancer.tags.sla == '24-7' |
| 71 |
|
| 72 |
- name: Test create a running load balancer with default flavor |
| 73 |
cloudscale_ch.cloud.load_balancer: |
| 74 |
name: '{{ cloudscale_resource_prefix }}-test2' |
| 75 |
zone: '{{ cloudscale_test_zone }}' |
| 76 |
register: load_balancer_default_flavor |
| 77 |
- name: Verify create a running load balancer with default flavor |
| 78 |
assert: |
| 79 |
that: |
| 80 |
- load_balancer_default_flavor is changed |
| 81 |
- load_balancer_default_flavor.status == 'running' |
| 82 |
- load_balancer_default_flavor.name == cloudscale_resource_prefix + '-test2' |
| 83 |
- load_balancer_default_flavor.flavor.slug == cloudscale_test_flavor_lb |
| 84 |
- load_balancer_default_flavor.zone.slug == cloudscale_test_zone |
| 85 |
|
| 86 |
# Get LB facts |
| 87 |
- name: Test get facts of a load balancer by name |
| 88 |
cloudscale_ch.cloud.load_balancer: |
| 89 |
name: '{{ load_balancer.name }}' |
| 90 |
register: load_balancer |
| 91 |
- name: Verify get a load balancer |
| 92 |
assert: |
| 93 |
that: |
| 94 |
- load_balancer is not changed |
| 95 |
- load_balancer.name == cloudscale_resource_prefix + '-test' |
| 96 |
|
| 97 |
# Update running LB |
| 98 |
- name: Test update name and tags of a running load balancer in check mode |
| 99 |
cloudscale_ch.cloud.load_balancer: |
| 100 |
uuid: '{{ load_balancer.uuid }}' |
| 101 |
name: '{{ cloudscale_resource_prefix }}-test-renamed' |
| 102 |
tags: |
| 103 |
project: ansible-test |
| 104 |
stage: staging |
| 105 |
sla: 8-5 |
| 106 |
register: load_balancer |
| 107 |
check_mode: yes |
| 108 |
- name: Verify update name and tags of a running load balancer in check mode |
| 109 |
assert: |
| 110 |
that: |
| 111 |
- load_balancer is changed |
| 112 |
- load_balancer.status == 'running' |
| 113 |
- load_balancer.name == cloudscale_resource_prefix + '-test' |
| 114 |
|
| 115 |
- name: Test update name and tags of a running load balancer |
| 116 |
cloudscale_ch.cloud.load_balancer: |
| 117 |
uuid: '{{ load_balancer.uuid }}' |
| 118 |
name: '{{ cloudscale_resource_prefix }}-test-renamed' |
| 119 |
tags: |
| 120 |
project: ansible-test |
| 121 |
stage: staging |
| 122 |
sla: 8-5 |
| 123 |
register: load_balancer |
| 124 |
- name: Verify update name of a running load balancer |
| 125 |
assert: |
| 126 |
that: |
| 127 |
- load_balancer is changed |
| 128 |
- load_balancer.status == 'running' |
| 129 |
- load_balancer.name == cloudscale_resource_prefix + '-test-renamed' |
| 130 |
- load_balancer.flavor.slug == cloudscale_test_flavor_lb |
| 131 |
- load_balancer.tags.project == 'ansible-test' |
| 132 |
- load_balancer.tags.stage == 'staging' |
| 133 |
- load_balancer.tags.sla == '8-5' |
| 134 |
|
| 135 |
- name: Test update name of a running load balancer idempotence |
| 136 |
cloudscale_ch.cloud.load_balancer: |
| 137 |
uuid: '{{ load_balancer.uuid }}' |
| 138 |
name: '{{ cloudscale_resource_prefix }}-test-renamed' |
| 139 |
tags: |
| 140 |
project: ansible-test |
| 141 |
stage: staging |
| 142 |
sla: 8-5 |
| 143 |
register: load_balancer |
| 144 |
- name: Verify update name of a running load balancer idempotence |
| 145 |
assert: |
| 146 |
that: |
| 147 |
- load_balancer is not changed |
| 148 |
- load_balancer.status == 'running' |
| 149 |
- load_balancer.name == cloudscale_resource_prefix + '-test-renamed' |
| 150 |
- load_balancer.flavor.slug == cloudscale_test_flavor_lb |
| 151 |
- load_balancer.tags.project == 'ansible-test' |
| 152 |
- load_balancer.tags.stage == 'staging' |
| 153 |
- load_balancer.tags.sla == '8-5' |
| 154 |
|
| 155 |
# Delete LB |
| 156 |
- name: Test running load balancer deletion by name in check mode |
| 157 |
cloudscale_ch.cloud.load_balancer: |
| 158 |
name: '{{ cloudscale_resource_prefix }}-test-renamed' |
| 159 |
state: absent |
| 160 |
register: load_balancer |
| 161 |
check_mode: yes |
| 162 |
- name: Verify running load balancer deletion by name in check mode |
| 163 |
assert: |
| 164 |
that: |
| 165 |
- load_balancer is changed |
| 166 |
- load_balancer.status == 'running' |
| 167 |
|
| 168 |
- name: Test running load balancer deletion by name |
| 169 |
cloudscale_ch.cloud.load_balancer: |
| 170 |
name: '{{ cloudscale_resource_prefix }}-test-renamed' |
| 171 |
state: absent |
| 172 |
register: load_balancer |
| 173 |
- name: Verify running load balancer deletion by name |
| 174 |
assert: |
| 175 |
that: |
| 176 |
- load_balancer is changed |
| 177 |
- load_balancer.state == 'absent' |
| 178 |
|
| 179 |
- name: Test running load balancer deletion by name idempotence |
| 180 |
cloudscale_ch.cloud.load_balancer: |
| 181 |
name: '{{ cloudscale_resource_prefix }}-test-renamed' |
| 182 |
state: absent |
| 183 |
register: load_balancer |
| 184 |
- name: Verify running load balancer deletion by name idempotence |
| 185 |
assert: |
| 186 |
that: |
| 187 |
- load_balancer is not changed |
| 188 |
- load_balancer.state == 'absent' |