aboutsummaryrefslogtreecommitdiffstats
path: root/puppet/services/openvswitch-upgrade.yaml
blob: f6e78462dc909d91b74f7d6a7e1203a5a35bc573 (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
heat_template_version: pike

description: >
  Openvswitch package special handling for upgrade.

outputs:
  role_data:
    description: Upgrade task for special handling of Openvswitch (OVS) upgrade.
    value:
      service_name: openvswitch_upgrade
      upgrade_tasks:
        - name: Check openvswitch version.
          tags: step2
          register: ovs_version
          ignore_errors: true
          shell: rpm -qa | awk -F- '/^openvswitch-2/{print $2 "-" $3}'
        - name: Check openvswitch packaging.
          tags: step2
          shell: rpm -q --scripts openvswitch | awk '/postuninstall/,/*/' | grep -q "systemctl.*try-restart"
          register: ovs_packaging_issue
          ignore_errors: true
        - block:
            - name: "Ensure empty directory: emptying."
              file:
                state: absent
                path: /root/OVS_UPGRADE
            - name: "Ensure empty directory: creating."
              file:
                state: directory
                path: /root/OVS_UPGRADE
                owner: root
                group: root
                mode: 0750
            - name: Download OVS packages.
              command: yumdownloader --destdir /root/OVS_UPGRADE --resolve openvswitch
            - name: Get rpm list for manual upgrade of OVS.
              shell: ls -1 /root/OVS_UPGRADE/*.rpm
              register: ovs_list_of_rpms
            - name: Manual upgrade of OVS
              shell: |
                rpm -U --test {{item}} 2>&1 | grep "already installed" || \
                rpm -U --replacepkgs --notriggerun --nopostun {{item}};
              args:
                chdir: /root/OVS_UPGRADE
              with_items:
                - "{{ovs_list_of_rpms.stdout_lines}}"
          tags: step2
          when: "'2.5.0-14' in '{{ovs_version.stdout}}'
                or
                ovs_packaging_issue|succeeded"