Reputation: 846
How can I add a new security group to a running instance without removing existing ones using Ansible?
I tried ec2 module but that doesn't look like changing anything even if I pass a new security group with instance id.
Any help please?
Upvotes: 1
Views: 3848
Reputation: 52423
There is no direct support for it in ansible. If you have AWS CLI
installed, use shell module to modify the SG. You must specify all security groups.
- shell: aws ec2 modify-instance-attribute --instance-id i-12345678 --groups sg-old-123def sg-new-abc123
Upvotes: 2