--- # When openshift_aws_use_custom_ami is '' then # we retrieve the latest build AMI. # Then set openshift_aws_ami to the ami. - when: openshift_aws_ami == '' block: - name: fetch recently created AMI ec2_ami_find: region: "{{ openshift_aws_region }}" sort: creationDate sort_order: descending name: "{{ openshift_aws_ami_name }}*" ami_tags: "{{ openshift_aws_ami_tags }}" no_result_action: fail register: amiout - name: Set the openshift_aws_ami set_fact: openshift_aws_ami: "{{ amiout.results[0].ami_id }}" when: - "'results' in amiout" - amiout.results|length > 0 # Need to set epoch time in one place to use for launch_config and scale_group - set_fact: l_epoch_time: "{{ ansible_date_time.epoch }}" # # query asg's and determine if we need to create the others. # if we find more than 1 for each type, then exit - name: query all asg's for this cluster ec2_asg_facts: region: "{{ openshift_aws_region }}" tags: "{{ {'kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid} | combine(openshift_aws_node_group.tags) }}" register: asgs - fail: msg: "Found more than 1 auto scaling group that matches the query for group: {{ openshift_aws_node_group }}" when: - asgs.results|length > 1 - debug: msg: "{{ asgs }}" - name: set the value for the deployment_serial and the current asgs set_fact: # scale_groups_serial is a custom filter in role lib_utils l_deployment_serial: "{{ openshift_aws_node_group_deployment_serial if openshift_aws_node_group_deployment_serial is defined else asgs.results | scale_groups_serial(openshift_aws_node_group_upgrade) }}" openshift_aws_current_asgs: "{{ asgs.results | map(attribute='auto_scaling_group_name') | list | union(openshift_aws_current_asgs) }}" - name: dump deployment serial debug: msg: "Deployment serial: {{ l_deployment_serial }}" - name: dump current_asgs debug: msg: "openshift_aws_current_asgs: {{ openshift_aws_current_asgs }}" - when: openshift_aws_create_iam_role include_tasks: iam_role.yml - when: openshift_aws_create_launch_config include_tasks: launch_config.yml - when: openshift_aws_create_scale_group include_tasks: scale_group.yml