Welcome, Guest! Registration


Friday, 2019-02-22
Main » 2016 » September » 15 » Get security group group_id for rds vpc_security_groups
8:15 PM
Get security group group_id for rds vpc_security_groups

If you are creating an unique security group for an RDS with ansible in AWS (Elastic Cloud 2). You may have to identify the group_id.

One possible way is to capture the id right after group creation. The group_id will be captured even if there is no new group created. The capture is accomplished by adding register: my_result_var to the end of the action. Of course you can put whatever name you need instead of my_result_var.

For example:
- name: Create RDS security group
  description: Allow PostgreSQL
  vpc_id: "{{ my_vpc_id }}"
    - proto: tcp
    to port: 5432
    state: present
  register: rds_sg_result

- name: Create RDS instance
  command: create
  subnet: "{{ my_subnet }}"
  vpc_security_groups: "{{ rds_sg_result.group_id }}"

Views: 645 | Added by: ep | Tags: ansible, amazon ec2, aws | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Registration | Login ]