mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cs_vpc: fix state=present to start vpc (#40587)
This commit is contained in:
parent
8e38668285
commit
f71cea052d
4 changed files with 9 additions and 10 deletions
|
@ -51,12 +51,13 @@ options:
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- "State of the VPC."
|
- "State of the VPC."
|
||||||
- "The state C(started) is only considered while creating the VPC, added in version 2.6."
|
- "The state C(present) creates a started VPC."
|
||||||
|
- "The state C(stopped) is only considered while creating the VPC, added in version 2.6."
|
||||||
default: present
|
default: present
|
||||||
choices:
|
choices:
|
||||||
- present
|
- present
|
||||||
- absent
|
- absent
|
||||||
- started
|
- stopped
|
||||||
- restarted
|
- restarted
|
||||||
domain:
|
domain:
|
||||||
description:
|
description:
|
||||||
|
@ -92,6 +93,7 @@ EXAMPLES = '''
|
||||||
name: my_vpc
|
name: my_vpc
|
||||||
display_text: My example VPC
|
display_text: My example VPC
|
||||||
cidr: 10.10.0.0/16
|
cidr: 10.10.0.0/16
|
||||||
|
state: stopped
|
||||||
|
|
||||||
- name: Ensure a VPC is present and started after creating
|
- name: Ensure a VPC is present and started after creating
|
||||||
local_action:
|
local_action:
|
||||||
|
@ -99,7 +101,6 @@ EXAMPLES = '''
|
||||||
name: my_vpc
|
name: my_vpc
|
||||||
display_text: My example VPC
|
display_text: My example VPC
|
||||||
cidr: 10.10.0.0/16
|
cidr: 10.10.0.0/16
|
||||||
state: started
|
|
||||||
|
|
||||||
- name: Ensure a VPC is absent
|
- name: Ensure a VPC is absent
|
||||||
local_action:
|
local_action:
|
||||||
|
@ -289,7 +290,7 @@ class AnsibleCloudStackVpc(AnsibleCloudStack):
|
||||||
'domainid': self.get_domain(key='id'),
|
'domainid': self.get_domain(key='id'),
|
||||||
'projectid': self.get_project(key='id'),
|
'projectid': self.get_project(key='id'),
|
||||||
'zoneid': self.get_zone(key='id'),
|
'zoneid': self.get_zone(key='id'),
|
||||||
'start': self.module.params.get('state') == 'started'
|
'start': self.module.params.get('state') != 'stopped'
|
||||||
}
|
}
|
||||||
self.result['diff']['after'] = args
|
self.result['diff']['after'] = args
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
|
@ -338,7 +339,7 @@ def main():
|
||||||
vpc_offering=dict(),
|
vpc_offering=dict(),
|
||||||
network_domain=dict(),
|
network_domain=dict(),
|
||||||
clean_up=dict(type='bool'),
|
clean_up=dict(type='bool'),
|
||||||
state=dict(choices=['present', 'absent', 'started', 'restarted'], default='present'),
|
state=dict(choices=['present', 'absent', 'stopped', 'restarted'], default='present'),
|
||||||
domain=dict(),
|
domain=dict(),
|
||||||
account=dict(),
|
account=dict(),
|
||||||
project=dict(),
|
project=dict(),
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
vpc_offering: Redundant VPC offering
|
vpc_offering: Redundant VPC offering
|
||||||
network_domain: test.example.com
|
network_domain: test.example.com
|
||||||
zone: "{{ cs_common_zone_adv }}"
|
zone: "{{ cs_common_zone_adv }}"
|
||||||
state: started
|
state: stopped
|
||||||
register: vpc
|
register: vpc
|
||||||
check_mode: true
|
check_mode: true
|
||||||
- name: verify test create vpc with custom offering in check mode
|
- name: verify test create vpc with custom offering in check mode
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
vpc_offering: Redundant VPC offering
|
vpc_offering: Redundant VPC offering
|
||||||
network_domain: test.example.com
|
network_domain: test.example.com
|
||||||
zone: "{{ cs_common_zone_adv }}"
|
zone: "{{ cs_common_zone_adv }}"
|
||||||
state: started
|
state: stopped
|
||||||
register: vpc
|
register: vpc
|
||||||
- name: verify test create vpc with custom offering
|
- name: verify test create vpc with custom offering
|
||||||
assert:
|
assert:
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
vpc_offering: Redundant VPC offering
|
vpc_offering: Redundant VPC offering
|
||||||
network_domain: test.example.com
|
network_domain: test.example.com
|
||||||
zone: "{{ cs_common_zone_adv }}"
|
zone: "{{ cs_common_zone_adv }}"
|
||||||
state: started
|
state: stopped
|
||||||
register: vpc
|
register: vpc
|
||||||
- name: verify test create vpc with custom offering idempotence
|
- name: verify test create vpc with custom offering idempotence
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
cloud/cs
|
cloud/cs
|
||||||
posix/ci/cloud/group1/cs
|
posix/ci/cloud/group1/cs
|
||||||
disabled
|
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
cloud/cs
|
cloud/cs
|
||||||
posix/ci/cloud/group1/cs
|
posix/ci/cloud/group1/cs
|
||||||
disabled
|
|
||||||
|
|
Loading…
Reference in a new issue