diff options
author | Thomas Wiest <twiest@users.noreply.github.com> | 2015-04-20 17:25:57 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@users.noreply.github.com> | 2015-04-20 17:25:57 -0400 |
commit | 96dd0ab929b7f391eee9b23209aa377537114b72 (patch) | |
tree | d1f9aa5becd04097213fe56aa4982bd35830df10 /playbooks/aws/openshift-master/terminate.yml | |
parent | 0722304b2f9c94a2f70054e0a3c7feceaedb195c (diff) | |
parent | dbb252bc04a6488c1fde05dbc325b246fd4a651e (diff) | |
download | openshift-96dd0ab929b7f391eee9b23209aa377537114b72.tar.gz openshift-96dd0ab929b7f391eee9b23209aa377537114b72.tar.bz2 openshift-96dd0ab929b7f391eee9b23209aa377537114b72.tar.xz openshift-96dd0ab929b7f391eee9b23209aa377537114b72.zip |
Merge pull request #139 from detiber/configUpdatesMaster
Massive refactor, deployment-type support, config updates, reduce duplication
Diffstat (limited to 'playbooks/aws/openshift-master/terminate.yml')
-rw-r--r-- | playbooks/aws/openshift-master/terminate.yml | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/playbooks/aws/openshift-master/terminate.yml b/playbooks/aws/openshift-master/terminate.yml index fd15cf00f..a790336b1 100644 --- a/playbooks/aws/openshift-master/terminate.yml +++ b/playbooks/aws/openshift-master/terminate.yml @@ -1,15 +1,15 @@ --- -- name: Populate oo_masters_to_terminate host group if needed +- name: Populate oo_masters_to_terminate host group hosts: localhost gather_facts: no tasks: - - name: Evaluate oo_host_group_exp if it's set - add_host: "name={{ item }} groups=oo_masters_to_terminate" - with_items: "{{ oo_host_group_exp | default('') }}" - when: oo_host_group_exp is defined + - name: Evaluate oo_masters_to_terminate + add_host: name={{ item }} groups=oo_masters_to_terminate + with_items: oo_host_group_exp | default([]) -- name: Gather facts for instances to terminate +- name: Gather dynamic inventory variables for hosts to terminate hosts: oo_masters_to_terminate + gather_facts: no - name: Terminate instances hosts: localhost @@ -27,11 +27,12 @@ ignore_errors: yes register: ec2_term with_items: host_vars + when: "'oo_masters_to_terminate' in groups" # Fail if any of the instances failed to terminate with an error other # than 403 Forbidden - fail: msg=Terminating instance {{ item.item.ec2_id }} failed with message {{ item.msg }} - when: "item.failed and not item.msg | search(\"error: EC2ResponseError: 403 Forbidden\")" + when: "'oo_masters_to_terminate' in groups and item.failed and not item.msg | search(\"error: EC2ResponseError: 403 Forbidden\")" with_items: ec2_term.results - name: Stop instance if termination failed @@ -42,6 +43,7 @@ register: ec2_stop when: item.failed with_items: ec2_term.results + when: "'oo_masters_to_terminate' in groups" - name: Rename stopped instances ec2_tag: resource={{ item.item.item.ec2_id }} region={{ item.item.item.ec2_region }} state=present @@ -49,4 +51,5 @@ tags: Name: "{{ item.item.item.ec2_tag_Name }}-terminate" with_items: ec2_stop.results + when: "'oo_masters_to_terminate' in groups" |