Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: Upgarding task
- remote_user: root
- gather_facts: yes
- tasks:
- - set_fact:
- stop_non_migratable_vms: "{{ stop_non_migratable_vms }}"
- - name: Login to oVirt
- ovirt_auth:
- url: "{{ engine_url }}"
- username: "{{ engine_user }}"
- password: "{{ engine_password }}"
- ca_file: "{{ engine_cafile | default(omit) }}"
- insecure: "{{ engine_insecure | default(true) }}"
- when: ovirt_auth is undefined
- register: loggedin
- tags:
- - always
- # GET_CLUSTER AND CHECK GLUSTER STATUS
- -block:
- - name: Get cluster facts
- ovirt_clusters_facts:
- auth: "{{ ovirt_auth }}"
- pattern: "name={{ cluster_name }}"
- service:
- name=glusterd
- state=started
- enabled=yes
- when: glusterd.changed
- - name: Iterating through gluster volumes and stopping geo-rep sessions
- gluster_volume: #<will take volume_count from gluster vol info? >
- service:
- name=geo-rep session #<-- find
- state=stopped
- when: geo_rep_status == "active" && volume_count | length !=0
- - name: Get hosts
- ovirt_hosts_facts:
- auth: "{{ ovirt_auth }}"
- pattern: "cluster={{ cluster_name | mandatory }} {{ check_upgrade | ternary('', 'update_available=true') }} {{ host_names | map('regex_replace', '(.*)', 'name=\\1') | list | join(' or ') }} {{ host_statuses | map('regex_replace', '(.*)', 'status=\\1') | list | join(' or ') }}"
- check_mode: no
- #Pattern: Search term which is accepted by oVirt/RHV search backend."
- #"For example to search host X from datacenter Y use following pattern: name=X and datacenter=Y"
- - name: Waiting for self healing process to finish
- ovirt_gluster: #If this is the name of the module
- when: no_of_enteries != 0 #triggering self heal in module
- - name: Stopping gluster process #this requires to be added to ovirt-gluster module
- ovirt_gluster:
- when: glusterd.status == "active"
- - block:
- - name: turning hosts to maintenance
- ovirt_hosts:
- state: maintenance
- name: ovirt_hosts
- when: h.status = "up"
- with_items:
- - ovirt_hosts
- - name: Host upgrading
- include_tasks: roles/ovirt-cluster-upgrade/tasks/upgrade.yml #iterate here for all the hosts.
- debug:
- msg: "No hosts to be updated"
- when: ovirt_hosts | length == 0
- - block:
- - name: Start glusterd process #To be added to ovirt-gluster module
- ovirt_gluster: #This will get gluster process status
- register: glusterd.status
- when: glusterd.status|failed
- - name: Start geo-rep session #To be added to ovirt-gluster module
- ovirt_gluster:
- register: geo_rep_session.status
- when: geo_rep_session.status | stopped
- always:
- - name: Logout from oVirt
- ovirt_auth:
- state: absent
- ovirt_auth: "{{ ovirt_auth }}"
- when: not loggedin.skipped | default(false)
- tags:
- - always
Add Comment
Please, Sign In to add comment