Guest User

Untitled

a guest
Nov 9th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. ---
  2. - name: Upgarding task
  3. remote_user: root
  4. gather_facts: yes
  5.  
  6. tasks:
  7. - set_fact:
  8. stop_non_migratable_vms: "{{ stop_non_migratable_vms }}"
  9.  
  10. - name: Login to oVirt
  11. ovirt_auth:
  12. url: "{{ engine_url }}"
  13. username: "{{ engine_user }}"
  14. password: "{{ engine_password }}"
  15. ca_file: "{{ engine_cafile | default(omit) }}"
  16. insecure: "{{ engine_insecure | default(true) }}"
  17. when: ovirt_auth is undefined
  18. register: loggedin
  19. tags:
  20. - always
  21.  
  22. # GET_CLUSTER AND CHECK GLUSTER STATUS
  23. -block:
  24. - name: Get cluster facts
  25. ovirt_clusters_facts:
  26. auth: "{{ ovirt_auth }}"
  27. pattern: "name={{ cluster_name }}"
  28. service:
  29. name=glusterd
  30. state=started
  31. enabled=yes
  32. when: glusterd.changed
  33.  
  34. - name: Iterating through gluster volumes and stopping geo-rep sessions
  35. gluster_volume: #<will take volume_count from gluster vol info? >
  36. service:
  37. name=geo-rep session #<-- find
  38. state=stopped
  39. when: geo_rep_status == "active" && volume_count | length !=0
  40.  
  41. - name: Get hosts
  42. ovirt_hosts_facts:
  43. auth: "{{ ovirt_auth }}"
  44. 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 ') }}"
  45. check_mode: no
  46. #Pattern: Search term which is accepted by oVirt/RHV search backend."
  47. #"For example to search host X from datacenter Y use following pattern: name=X and datacenter=Y"
  48.  
  49. - name: Waiting for self healing process to finish
  50. ovirt_gluster: #If this is the name of the module
  51. when: no_of_enteries != 0 #triggering self heal in module
  52.  
  53. - name: Stopping gluster process #this requires to be added to ovirt-gluster module
  54. ovirt_gluster:
  55. when: glusterd.status == "active"
  56.  
  57. - block:
  58. - name: turning hosts to maintenance
  59. ovirt_hosts:
  60. state: maintenance
  61. name: ovirt_hosts
  62. when: h.status = "up"
  63. with_items:
  64. - ovirt_hosts
  65.  
  66. - name: Host upgrading
  67. include_tasks: roles/ovirt-cluster-upgrade/tasks/upgrade.yml #iterate here for all the hosts.
  68. debug:
  69. msg: "No hosts to be updated"
  70. when: ovirt_hosts | length == 0
  71.  
  72. - block:
  73. - name: Start glusterd process #To be added to ovirt-gluster module
  74. ovirt_gluster: #This will get gluster process status
  75. register: glusterd.status
  76. when: glusterd.status|failed
  77.  
  78. - name: Start geo-rep session #To be added to ovirt-gluster module
  79. ovirt_gluster:
  80. register: geo_rep_session.status
  81. when: geo_rep_session.status | stopped
  82.  
  83. always:
  84. - name: Logout from oVirt
  85. ovirt_auth:
  86. state: absent
  87. ovirt_auth: "{{ ovirt_auth }}"
  88. when: not loggedin.skipped | default(false)
  89. tags:
  90. - always
Add Comment
Please, Sign In to add comment