do until where the until is a json property

27 views
Skip to first unread message

Robin Southgate

unread,
Oct 3, 2015, 9:11:23 AM10/3/15
to Ansible Project
Hi,
I'd like to do something like the following:

- name: Wait for Security Group to be applied
  command
: "aws rds describe-db-instances --db-instance-identifier {{ target_db_environment }}-mysql-db-{{ current_time }} --output json"
 
register: db_info
  set_fact
:  
    security_group_json
: "{{ db_info | from_json }}"
    security_group
: "{{ security_group_json.DBInstances[0].VpcSecurityGroups[0].VpcSecurityGroupId }}"
    security_group_active
: "{{ security_group_json.DBInstances[0].VpcSecurityGroups[0].Status }}"
 
until: "{{ security_group }} == 'sg-XXXXXXXX' && {{ security_group_active }} == 'Active'"
  retries
: 5
  delay
: 5


But I can't mix the set_fact in there like that. Is there any way, within the register two properties of the returned json? Otherwise is my only option a regex in the until that looks for both the security group and the Status=Active?

Reply all
Reply to author
Forward
0 new messages