Skip to content

Instantly share code, notes, and snippets.

@goern
Forked from carlessanagustin/ec2_group_project.yml
Last active April 10, 2018 15:25
Show Gist options
  • Save goern/408f96f91a2b32c5018936803b528398 to your computer and use it in GitHub Desktop.
Save goern/408f96f91a2b32c5018936803b528398 to your computer and use it in GitHub Desktop.
ANSIBLE: Change AWS EC2 Security Group configuration.
#!/usr/local/bin/ansible-playbook -v
---
- hosts: apache0
vars:
rule_list:
- { proto: icmp, type: 3, code: 4, src_cidr_ip: 0.0.0.0/0 }
ec2_group_region: 'us-east-2'
ec2_group_vpc: 'vpc-295720575'
ec2_group_description: 'change for AI Ops Recommendation by Red Hat Insights'
ec2_group_name: security_group_name
vars_files:
- vars/aws_config.yml
tasks:
- name: Change security group
ec2_group:
name: '{{ ec2_group_name }}'
description: '{{ ec2_group_description }}'
vpc_id: '{{ ec2_group_vpc }}'
aws_access_key: '{{ access_key }}'
aws_secret_key: '{{ secret_key }}'
region: '{{ ec2_group_region }}'
rules: '{{ rule_list }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment