diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-12-12 09:15:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-12 09:15:52 -0500 |
commit | 01ae634a0bf89fe840006f9139f8ffd20e09afc8 (patch) | |
tree | d53a7c03e4855885e124559018fff32adeaaf4ea /roles/openshift_aws/tasks/setup_scale_group_facts.yml | |
parent | 0b6fa3dcd40c2dd1f42fcceb52f82c2a28ed96e2 (diff) | |
parent | 35c1abb6050f2cd1f31396edd42618a2998bd546 (diff) | |
download | openshift-01ae634a0bf89fe840006f9139f8ffd20e09afc8.tar.gz openshift-01ae634a0bf89fe840006f9139f8ffd20e09afc8.tar.bz2 openshift-01ae634a0bf89fe840006f9139f8ffd20e09afc8.tar.xz openshift-01ae634a0bf89fe840006f9139f8ffd20e09afc8.zip |
Merge pull request #6335 from kwoodson/node_groups_refactor
Node group management update.
Diffstat (limited to 'roles/openshift_aws/tasks/setup_scale_group_facts.yml')
-rw-r--r-- | roles/openshift_aws/tasks/setup_scale_group_facts.yml | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/roles/openshift_aws/tasks/setup_scale_group_facts.yml b/roles/openshift_aws/tasks/setup_scale_group_facts.yml index d65fdc2de..14c5246c9 100644 --- a/roles/openshift_aws/tasks/setup_scale_group_facts.yml +++ b/roles/openshift_aws/tasks/setup_scale_group_facts.yml @@ -1,11 +1,15 @@ --- -- name: group scale group nodes - ec2_remote_facts: +- name: fetch all created instances + ec2_instance_facts: region: "{{ openshift_aws_region }}" filters: - "{{ {'tag:kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid }}}" + "{{ {'tag:kubernetes.io/cluster/' ~ openshift_aws_clusterid: openshift_aws_clusterid, + 'instance-state-name': 'running'} }}" register: qinstances +# The building of new and current groups is dependent of having a list of the current asgs and the created ones +# that can be found in the variables: openshift_aws_created_asgs, openshift_aws_current_asgs. If these do not exist, we cannot determine which hosts are +# new and which hosts are current. - name: Build new node group add_host: groups: oo_sg_new_nodes @@ -13,10 +17,16 @@ name: "{{ item.public_dns_name }}" hostname: "{{ item.public_dns_name }}" when: - - (item.tags.version | default(False)) == openshift_aws_new_version + - openshift_aws_created_asgs != [] + - "'aws:autoscaling:groupName' in item.tags" + - item.tags['aws:autoscaling:groupName'] in openshift_aws_created_asgs - "'node' in item.tags['host-type']" with_items: "{{ qinstances.instances }}" +- name: dump openshift_aws_current_asgs + debug: + msg: "{{ openshift_aws_current_asgs }}" + - name: Build current node group add_host: groups: oo_sg_current_nodes @@ -24,7 +34,9 @@ name: "{{ item.public_dns_name }}" hostname: "{{ item.public_dns_name }}" when: - - (item.tags.version | default('')) == openshift_aws_current_version + - openshift_aws_current_asgs != [] + - "'aws:autoscaling:groupName' in item.tags" + - item.tags['aws:autoscaling:groupName'] in openshift_aws_current_asgs - "'node' in item.tags['host-type']" with_items: "{{ qinstances.instances }}" |