Commit 7c386c09 authored by Rafael Monnerat's avatar Rafael Monnerat

playbook: Add trigger script to reboot if it is required

  The invokation of the script is done manually, in future we might have a cron task
parent aa9ce4f9
#!/bin/bash
FILE=/opt/upgrader/REBOOT_REQUIRED
if [ -f "$FILE"];
then
rm $FILE
reboot
fi
---
- name: Mark to reboot
file:
path: /opt/upgrader/REBOOT_REQUIRED
state: touch
mode: u=rw,g=r,o=r
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
- name: Install kernel 4.9 on debian 9.0 - name: Install kernel 4.9 on debian 9.0
apt: name=linux-image-4.9.0-9-amd64 state=latest update_cache=no apt: name=linux-image-4.9.0-9-amd64 state=latest update_cache=no
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9" when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9"
notify: [ 'Mark to reboot' ]
- name: Install Debian jessie-backports repository - name: Install Debian jessie-backports repository
apt_repository: repo='deb http://ftp.debian.org/debian jessie-backports main' state=present update_cache=yes apt_repository: repo='deb http://ftp.debian.org/debian jessie-backports main' state=present update_cache=yes
...@@ -11,6 +12,7 @@ ...@@ -11,6 +12,7 @@
- name: Install kernel 4.9 on debian 8.0 - name: Install kernel 4.9 on debian 8.0
apt: name=linux-image-4.9.0-0.bpo.9-amd64 state=latest default_release=jessie-backports update_cache=yes apt: name=linux-image-4.9.0-0.bpo.9-amd64 state=latest default_release=jessie-backports update_cache=yes
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "8" when: ansible_distribution == "Debian" and ansible_distribution_major_version == "8"
notify: [ 'Mark to reboot' ]
- name: Install Debian jessie repository on debian 7 - name: Install Debian jessie repository on debian 7
lineinfile: lineinfile:
...@@ -27,3 +29,7 @@ ...@@ -27,3 +29,7 @@
- name: Dist upgrade debian 7 to debian 8 - name: Dist upgrade debian 7 to debian 8
apt: upgrade=dist update_cache=yes apt: upgrade=dist update_cache=yes
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "7" when: ansible_distribution == "Debian" and ansible_distribution_major_version == "7"
notify: [ 'Mark to reboot' ]
- name: create trigger reboot script
copy: src=slapos-trigger-reboot.sh dest=/usr/local/bin/slapos-trigger-reboot.sh mode=700
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment