Last active
March 7, 2019 20:44
-
-
Save s-hertel/e66141d54f4a0c9ed5cc81116dee4428 to your computer and use it in GitHub Desktop.
aws_ec2 config file for script compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you set ANSIBLE_TRANSFORM_INVALID_GROUP_CHARS=False | |
plugin: aws_ec2 | |
boto_profile: shertel | |
use_legacy_script_group_name_sanitization: True | |
keyed_groups: | |
- prefix: tag | |
key: tags | |
- prefix: key | |
key: key_name | |
- prefix: "" | |
separator: "" | |
key: placement.region | |
- prefix: "" | |
separator: "" | |
key: placement.availability_zone | |
- key: platform | |
- key: vpc_id | |
- prefix: type | |
key: instance_type | |
- prefix: instance_state | |
key: state.name | |
- prefix: "" | |
separator: "" | |
key: image_id | |
- key: 'security_groups | json_query("[].group_name")' | |
prefix: security_group | |
compose: | |
ec2_id: instance_id | |
# vars that change | |
ec2_block_devices: dict(block_device_mappings | map(attribute='device_name') | list | zip(block_device_mappings | map(attribute='ebs.volume_id') | list)) | |
ec2_dns_name: public_dns_name | |
ec2_group_name: placement.group_name | |
ec2_instance_profile: iam_instance_profile | default("") | |
ec2_ip_address: public_ip_address | |
ec2_kernel: kernel_id | default("") | |
ec2_monitored: monitoring.state in ['enabled', 'pending'] | |
ec2_monitoring_state: monitoring.state | |
ec2_placement: placement.availability_zone | |
ec2_ramdisk: ramdisk_id | default("") | |
ec2_reason: state_transition_reason | |
ec2_security_group_ids: security_groups | map(attribute='group_id') | list | join(',') | |
ec2_security_group_names: security_groups | map(attribute='group_name') | list | join(',') | |
ec2_tag_Name: tags.Name | |
ec2_state: state.name | |
ec2_state_code: state.code | int | |
ec2_state_reason: state_reason.message if state_reason is defined else "" | |
ec2_sourceDestCheck: source_dest_check # butchered snake_case case not a typo. | |
ec2_account_id: 'network_interfaces | json_query("[0].owner_id")' | |
# vars that just need ec2_ prefix | |
ec2_ami_launch_index: ami_launch_index | |
ec2_architecture: architecture | |
ec2_client_token: client_token | |
ec2_ebs_optimized: ebs_optimized | |
ec2_hypervisor: hypervisor | |
ec2_image_id: image_id | |
ec2_instance_type: instance_type | |
ec2_key_name: key_name | |
ec2_launch_time: launch_time | |
ec2_platform: platform | default("") | |
ec2_private_dns_name: private_dns_name | |
ec2_private_ip_address: private_ip_address | |
ec2_public_dns_name: public_dns_name | |
ec2_region: placement.region | |
ec2_root_device_name: root_device_name | |
ec2_root_device_type: root_device_type | |
ec2_spot_instance_request_id: spot_instance_request_id | |
ec2_subnet_id: subnet_id | |
ec2_virtualization_type: virtualization_type | |
ec2_vpc_id: vpc_id | |
hostnames: | |
- network-interface.addresses.association.public-ip | |
- dns-name | |
- private-dns-name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you set ANSIBLE_TRANSFORM_INVALID_GROUP_CHARS=False | |
plugin: aws_ec2 | |
boto_profile: shertel | |
use_legacy_script_group_name_sanitization: True | |
keyed_groups: | |
- prefix: tag | |
key: tags | regex_replace('-', '_') | |
- prefix: key | |
key: key_name.replace('-', '_') | |
- prefix: "" | |
separator: "" | |
key: placement.region | |
- prefix: "" | |
separator: "" | |
key: placement.availability_zone | |
- key: platform.replace('-', '_') | |
- key: vpc_id.replace('-', '_') | |
- prefix: type | |
key: instance_type.replace('-', '_') | |
- prefix: instance_state | |
key: state.name.replace('-', '_') | |
- prefix: "" | |
separator: "" | |
key: image_id.replace('-', '_') | |
- key: 'security_groups | json_query("[].group_name") | regex_replace("-", "_")' | |
prefix: security_group | |
compose: | |
ec2_id: instance_id | |
# vars that change | |
ec2_block_devices: dict(block_device_mappings | map(attribute='device_name') | list | zip(block_device_mappings | map(attribute='ebs.volume_id') | list)) | |
ec2_dns_name: public_dns_name | |
ec2_group_name: placement.group_name | |
ec2_instance_profile: iam_instance_profile | default("") | |
ec2_ip_address: public_ip_address | |
ec2_kernel: kernel_id | default("") | |
ec2_monitored: monitoring.state in ['enabled', 'pending'] | |
ec2_monitoring_state: monitoring.state | |
ec2_placement: placement.availability_zone | |
ec2_ramdisk: ramdisk_id | default("") | |
ec2_reason: state_transition_reason | |
ec2_security_group_ids: security_groups | map(attribute='group_id') | list | join(',') | |
ec2_security_group_names: security_groups | map(attribute='group_name') | list | join(',') | |
ec2_tag_Name: tags.Name | |
ec2_state: state.name | |
ec2_state_code: state.code | int | |
ec2_state_reason: state_reason.message if state_reason is defined else "" | |
ec2_sourceDestCheck: source_dest_check # butchered snake_case case not a typo. | |
ec2_account_id: 'network_interfaces | json_query("[0].owner_id")' | |
# vars that just need ec2_ prefix | |
ec2_ami_launch_index: ami_launch_index | |
ec2_architecture: architecture | |
ec2_client_token: client_token | |
ec2_ebs_optimized: ebs_optimized | |
ec2_hypervisor: hypervisor | |
ec2_image_id: image_id | |
ec2_instance_type: instance_type | |
ec2_key_name: key_name | |
ec2_launch_time: launch_time | |
ec2_platform: platform | default("") | |
ec2_private_dns_name: private_dns_name | |
ec2_private_ip_address: private_ip_address | |
ec2_public_dns_name: public_dns_name | |
ec2_region: placement.region | |
ec2_root_device_name: root_device_name | |
ec2_root_device_type: root_device_type | |
ec2_spot_instance_request_id: spot_instance_request_id | |
ec2_subnet_id: subnet_id | |
ec2_virtualization_type: virtualization_type | |
ec2_vpc_id: vpc_id | |
hostnames: | |
- network-interface.addresses.association.public-ip | |
- dns-name | |
- private-dns-name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment