steampunk / steampunk.aws / 0.9.0 / module / ec2_internet_gateway Manage EC2 Internet Gateways Authors: Manca Bizjak (@mancabizjak), Aljaz Kosir (@aljazkosir), Saso Stanovnik (@sstanovnik), Miha Dolinar (@mdolinar), Tadej Borovsak (@tadeboro) preview | supported by XLAB Steampunksteampunk.aws.ec2_internet_gateway (0.9.0) — module
Install with ansible-galaxy collection install steampunk.aws:==0.9.0
collections: - name: steampunk.aws version: 0.9.0
Create, update or delete AWS EC2 Internet Gateway and its attachment to a VPC.
- name: Create a detached internet gateway ec2_internet_gateway: name: detached-gateway state: detached register: detached_gateway
- name: Attach a previously detached internet gateway to a VPC ec2_internet_gateway: id: "{{ detached_gateway.object.id }}" vpc: vpc-2w7hs924hss register: result
- name: Detach and delete an internet gateway ec2_internet_gateway: id: "{{ result.object.id }}" state: absent
- name: Create another internet gateway, this time with VPC attachment ec2_internet_gateway: name: attached-gateway vpc: vpc-2w7hs924hss register: attached_gateway
- name: Detach an internet gateway from a VPC ec2_internet_gateway: id: "{{ attached_gateway.object.id }}" state: detached
id: description: - ID of the resource to perform the task on. - If specified, this parameter is used to identify the resource. - Omit this parameter when you are first creating the resource. type: str vpc: description: - ID of the VPC to attach the internet gateway to. - If the internet gateway is already attached to a VPC different to the one specified, the module will detach the gateway from the VPC and attach it to the specified one. - Required if I(state) is C(attached). - When I(state) is C(detached) or C(absent), the value of this parameter is ignored. type: str auth: description: - Parameters for authenticating with the AWS service. Each of them may be defined via environment variables. suboptions: access_key: description: - The AWS access key ID. If not set, the value of the AWS_ACCESS_KEY environment variable will be checked. - Mutually exclusive with I(profile). required: false type: str profile: description: - The name of the AWS profile configured with C(aws configure). - Can be used instead of explicitly specifying your access credentials and region. - Use C(default) to use the default profile. - Mutually exclusive with I(access_key) and I(secret_key). required: false type: str region: description: - The name of the AWS region. - If not set, the value of the AWS_REGION environment variable will be checked. - If you set a I(profile) that specifies a default region, that region is used and you can omit this parameter. Use this parameter to override the profile's default region. type: str secret_key: description: - The AWS secret access key. If not set, the value of the AWS_SECRET_KEY environment variable will be checked. - Mutually exclusive with I(profile). required: false type: str url: description: - The URL to the AWS service related to the resource. By default, this is automatically determined through the region parameter. - If not set explicitly, the value of the AWS_<SERVICE>_URL environment variable will be used. - The services currently supported are EC2 and S3. required: false type: str type: dict name: description: - Name tag for the internet gateway. - This parameter is required when creating the internet gateway. - In the absence of I(id), the value of this parameter will be used to try to identify the internet gateway. type: str tags: description: - Metadata for the AWS resource as key/value pairs. - Keys and values are case-sensitive. type: dict state: choices: - attached - detached - absent default: attached description: - The desired state of the internet gateway. - To create and attach an internet gateway to a VPC, or to attach an existing internet gateway to a VPC, use I(state) = C(attached). - To create an internet gateway without attaching it to a VPC, or to detach an existing internet gateway from a VPC, use I(state) = C(detached). - To remove the internet gateway, use C(absent). Note that if necessary, VPC will be detached prior to removing the internet gateway. type: str clear_tags: default: false description: - Whether to clear any existing tags on the resource that are not explicitly stated in I(tags). - By default, existing tags are kept on the resource. - When this parameter is set to C(true), any pre-existing tags on the resource (including the name tag) are removed. To clear all tags except the name tag, make sure to provide the I(name) parameter. type: bool
object: contains: id: description: ID of the internet gateway returned: always sample: igw-841b9271gd type: str tags: description: Tags associated with the internet gateway. returned: always sample: Name: my-gateway environment: staging type: dict vpc: description: ID of the VPC the internet gateway is attached to, None otherwise. returned: always sample: vpc-2w7hs924hs type: str description: - An object representing an EC2 Internet Gateway. returned: success and I(state=attached) or I(state=detached) type: complex