瀏覽代碼

test/ci: update atomic hosts and restart only when necessary

Vadim Rutkovsky 6 年之前
父節點
當前提交
368970fe9c
共有 1 個文件被更改,包括 12 次插入0 次删除
  1. 12 0
      test/ci/launch.yml

+ 12 - 0
test/ci/launch.yml

@@ -78,15 +78,27 @@
     - name: Make sure hostname is set to public ansible host
     - name: Make sure hostname is set to public ansible host
       hostname:
       hostname:
         name: "{{ ansible_host }}"
         name: "{{ ansible_host }}"
+    - name: Detecting Operating System
+      shell: ls /run/ostree-booted
+      ignore_errors: yes
+      failed_when: false
+      register: ostree_output
     - name: Update all packages
     - name: Update all packages
       package:
       package:
         name: '*'
         name: '*'
         state: latest
         state: latest
+      when: ostree_output.rc != 0
+      register: yum_update
+    - name: Update Atomic system
+      command: atomic host upgrade
+      when: ostree_output.rc == 0
+      register: ostree_update
     - name: Reboot machines
     - name: Reboot machines
       shell: sleep 5 && systemctl reboot
       shell: sleep 5 && systemctl reboot
       async: 1
       async: 1
       poll: 0
       poll: 0
       ignore_errors: true
       ignore_errors: true
+      when: yum_update | changed or ostree_update | changed
     - name: Wait for connection
     - name: Wait for connection
       wait_for_connection:
       wait_for_connection:
         connect_timeout: 20
         connect_timeout: 20