summaryrefslogtreecommitdiffstats
path: root/playbooks/common/openshift-cluster/upgrades/etcd/main.yml
blob: fa86d29fb35fa7a5b7b18c367c2a5da4a37737d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
# For 1.4/3.4 we want to upgrade everyone to etcd-3.0. etcd docs say to
# upgrade from 2.0.x to 2.1.x to 2.2.x to 2.3.x to 3.0.x. While this is a tedius
# task for RHEL and CENTOS it's simply not possible in Fedora unless you've
# mirrored packages on your own because only the GA and latest versions are
# available in the repos. So for Fedora we'll simply skip this, sorry.

- include: ../../evaluate_groups.yml
  tags:
  - always

# We use two groups one for hosts we're upgrading which doesn't include embedded etcd
# The other for backing up which includes the embedded etcd host, there's no need to
# upgrade embedded etcd that just happens when the master is updated.
- name: Evaluate additional groups for etcd
  hosts: localhost
  connection: local
  become: no
  tasks:
  - name: Evaluate etcd_hosts_to_upgrade
    add_host:
      name: "{{ item }}"
      groups: etcd_hosts_to_upgrade
    with_items: "{{ groups.oo_etcd_to_config if groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config | length > 0 else [] }}"
    changed_when: False

  - name: Evaluate etcd_hosts_to_backup
    add_host:
      name: "{{ item }}"
      groups: etcd_hosts_to_backup
    with_items: "{{ groups.oo_etcd_to_config if groups.oo_etcd_to_config is defined and groups.oo_etcd_to_config | length > 0 else groups.oo_first_master }}"
    changed_when: False

- name: Backup etcd before upgrading anything
  include: backup.yml
  vars:
    backup_tag: "pre-upgrade-"
  when: openshift_etcd_backup | default(true) | bool

- name: Drop etcdctl profiles
  hosts: etcd_hosts_to_upgrade
  tasks:
  - include: roles/etcd/tasks/etcdctl.yml

- name: Perform etcd upgrade
  include: ./upgrade.yml
  when: openshift_etcd_upgrade | default(true) | bool