upgrade.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ---
  2. - name: Determine etcd version
  3. hosts: oo_etcd_hosts_to_upgrade
  4. tasks:
  5. - block:
  6. - name: Record RPM based etcd version
  7. command: rpm -qa --qf '%{version}' etcd\*
  8. args:
  9. warn: no
  10. register: etcd_rpm_version
  11. failed_when: false
  12. # AUDIT:changed_when: `false` because we are only inspecting
  13. # state, not manipulating anything
  14. changed_when: false
  15. - debug:
  16. msg: "Etcd rpm version {{ etcd_rpm_version.stdout }} detected"
  17. when:
  18. - not openshift.common.is_containerized | bool
  19. - block:
  20. - name: Record containerized etcd version (docker)
  21. command: docker exec etcd_container rpm -qa --qf '%{version}' etcd\*
  22. register: etcd_container_version_docker
  23. failed_when: false
  24. # AUDIT:changed_when: `false` because we are only inspecting
  25. # state, not manipulating anything
  26. changed_when: false
  27. when:
  28. - not openshift.common.is_etcd_system_container | bool
  29. # Given a register variables is set even if the whwen condition
  30. # is false, we need to set etcd_container_version separately
  31. - set_fact:
  32. etcd_container_version: "{{ etcd_container_version_docker.stdout }}"
  33. when:
  34. - not openshift.common.is_etcd_system_container | bool
  35. - name: Record containerized etcd version (runc)
  36. command: runc exec etcd rpm -qa --qf '%{version}' etcd\*
  37. register: etcd_container_version_runc
  38. failed_when: false
  39. # AUDIT:changed_when: `false` because we are only inspecting
  40. # state, not manipulating anything
  41. changed_when: false
  42. when:
  43. - openshift.common.is_etcd_system_container | bool
  44. # Given a register variables is set even if the whwen condition
  45. # is false, we need to set etcd_container_version separately
  46. - set_fact:
  47. etcd_container_version: "{{ etcd_container_version_runc.stdout }}"
  48. when:
  49. - openshift.common.is_etcd_system_container | bool
  50. - debug:
  51. msg: "Etcd containerized version {{ etcd_container_version }} detected"
  52. when:
  53. - openshift.common.is_containerized | bool
  54. - include: upgrade_rpm_members.yml
  55. vars:
  56. etcd_upgrade_version: '2.1'
  57. - include: upgrade_rpm_members.yml
  58. vars:
  59. etcd_upgrade_version: '2.2'
  60. - include: upgrade_image_members.yml
  61. vars:
  62. etcd_upgrade_version: '2.2.5'
  63. - include: upgrade_rpm_members.yml
  64. vars:
  65. etcd_upgrade_version: '2.3'
  66. - include: upgrade_image_members.yml
  67. vars:
  68. etcd_upgrade_version: '2.3.7'
  69. - include: upgrade_rpm_members.yml
  70. vars:
  71. etcd_upgrade_version: '3.0'
  72. - include: upgrade_image_members.yml
  73. vars:
  74. etcd_upgrade_version: '3.0.15'
  75. - include: upgrade_rpm_members.yml
  76. vars:
  77. etcd_upgrade_version: '3.1'
  78. - include: upgrade_image_members.yml
  79. vars:
  80. etcd_upgrade_version: '3.1.3'
  81. - include: upgrade_rpm_members.yml
  82. vars:
  83. etcd_upgrade_version: '3.2'
  84. - include: upgrade_image_members.yml
  85. vars:
  86. etcd_upgrade_version: '3.2.7'
  87. - name: Upgrade fedora to latest
  88. hosts: oo_etcd_hosts_to_upgrade
  89. serial: 1
  90. tasks:
  91. - include_role:
  92. name: etcd
  93. tasks_from: upgrade_image
  94. vars:
  95. r_etcd_common_etcd_runtime: "host"
  96. etcd_peer: "{{ openshift.common.hostname }}"
  97. when:
  98. - ansible_distribution == 'Fedora'
  99. - not openshift.common.is_containerized | bool