summaryrefslogtreecommitdiffstats
path: root/roles/etcd/tasks/version_detect.yml
blob: ab3626cec85b2cce954784692e431af7140dfc7d (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
48
49
50
51
52
53
54
55
---
- block:
  - name: Record RPM based etcd version
    command: rpm -qa --qf '%{version}' etcd\*
    args:
      warn: no
    register: etcd_rpm_version
    failed_when: false
    # AUDIT:changed_when: `false` because we are only inspecting
    # state, not manipulating anything
    changed_when: false
  - debug:
      msg: "Etcd rpm version {{ etcd_rpm_version.stdout }} detected"
  when:
  - not openshift_is_containerized | bool

- block:
  - name: Record containerized etcd version (docker)
    command: docker exec etcd_container rpm -qa --qf '%{version}' etcd\*
    register: etcd_container_version_docker
    failed_when: false
    # AUDIT:changed_when: `false` because we are only inspecting
    # state, not manipulating anything
    changed_when: false
    when:
    - not l_is_etcd_system_container | bool

    # Given a register variables is set even if the whwen condition
    # is false, we need to set etcd_container_version separately
  - set_fact:
      etcd_container_version: "{{ etcd_container_version_docker.stdout }}"
    when:
    - not l_is_etcd_system_container | bool

  - name: Record containerized etcd version (runc)
    command: runc exec etcd rpm -qa --qf '%{version}' etcd\*
    register: etcd_container_version_runc
    failed_when: false
    # AUDIT:changed_when: `false` because we are only inspecting
    # state, not manipulating anything
    changed_when: false
    when:
    - l_is_etcd_system_container | bool

    # Given a register variables is set even if the whwen condition
    # is false, we need to set etcd_container_version separately
  - set_fact:
      etcd_container_version: "{{ etcd_container_version_runc.stdout }}"
    when:
    - l_is_etcd_system_container | bool

  - debug:
      msg: "Etcd containerized version {{ etcd_container_version }} detected"
  when:
  - openshift_is_containerized | bool