mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[cloud] ec2_customer_gateway: add routing option to allow bgp_asn to be optional (#27276)
fixes #27157 add routing option to allow bgp_asn to be optional
This commit is contained in:
parent
ec8cbbf926
commit
ad2c1e1838
2 changed files with 11 additions and 3 deletions
|
@ -47,6 +47,12 @@ options:
|
||||||
description:
|
description:
|
||||||
- Name of the customer gateway.
|
- Name of the customer gateway.
|
||||||
required: true
|
required: true
|
||||||
|
routing:
|
||||||
|
description:
|
||||||
|
- The type of routing.
|
||||||
|
choices: ['static', 'dynamic']
|
||||||
|
default: dynamic
|
||||||
|
version_added: '2.4'
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Create or terminate the Customer Gateway.
|
- Create or terminate the Customer Gateway.
|
||||||
|
@ -129,7 +135,7 @@ except ImportError:
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.ec2 import (boto3_conn, camel_dict_to_snake_dict,
|
from ansible.module_utils.ec2 import (boto3_conn, camel_dict_to_snake_dict,
|
||||||
ec2_argument_spec, get_aws_connection_info)
|
ec2_argument_spec, get_aws_connection_info)
|
||||||
|
|
||||||
|
|
||||||
class Ec2CustomerGatewayManager:
|
class Ec2CustomerGatewayManager:
|
||||||
|
@ -153,6 +159,8 @@ class Ec2CustomerGatewayManager:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def ensure_cgw_present(self, bgp_asn, ip_address):
|
def ensure_cgw_present(self, bgp_asn, ip_address):
|
||||||
|
if not bgp_asn:
|
||||||
|
bgp_asn = 65000
|
||||||
response = self.ec2.create_customer_gateway(
|
response = self.ec2.create_customer_gateway(
|
||||||
DryRun=False,
|
DryRun=False,
|
||||||
Type='ipsec.1',
|
Type='ipsec.1',
|
||||||
|
@ -204,6 +212,7 @@ def main():
|
||||||
bgp_asn=dict(required=False, type='int'),
|
bgp_asn=dict(required=False, type='int'),
|
||||||
ip_address=dict(required=True),
|
ip_address=dict(required=True),
|
||||||
name=dict(required=True),
|
name=dict(required=True),
|
||||||
|
routing=dict(default='dynamic', choices=['dynamic', 'static']),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -211,7 +220,7 @@ def main():
|
||||||
module = AnsibleModule(argument_spec=argument_spec,
|
module = AnsibleModule(argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
required_if=[
|
required_if=[
|
||||||
('state', 'present', ['bgp_asn'])
|
('routing', 'dynamic', ['bgp_asn'])
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ lib/ansible/modules/cloud/amazon/dynamodb_table.py
|
||||||
lib/ansible/modules/cloud/amazon/ec2_ami.py
|
lib/ansible/modules/cloud/amazon/ec2_ami.py
|
||||||
lib/ansible/modules/cloud/amazon/ec2_ami_copy.py
|
lib/ansible/modules/cloud/amazon/ec2_ami_copy.py
|
||||||
lib/ansible/modules/cloud/amazon/ec2_ami_find.py
|
lib/ansible/modules/cloud/amazon/ec2_ami_find.py
|
||||||
lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py
|
|
||||||
lib/ansible/modules/cloud/amazon/ec2_eip.py
|
lib/ansible/modules/cloud/amazon/ec2_eip.py
|
||||||
lib/ansible/modules/cloud/amazon/ec2_eni_facts.py
|
lib/ansible/modules/cloud/amazon/ec2_eni_facts.py
|
||||||
lib/ansible/modules/cloud/amazon/ec2_key.py
|
lib/ansible/modules/cloud/amazon/ec2_key.py
|
||||||
|
|
Loading…
Reference in a new issue