Something went wrong on our end
-
Baptiste DE RENZO authoredBaptiste DE RENZO authored
migrate-debian.yml 4.87 KiB
#!/usr/bin/env ansible-playbook
---
- name: MIGRATE TO DEBIAN 10
hosts: all
tasks:
- name: check / space
shell:
cmd: '[ $(df --output="avail" / | tail -n 1) -gt 4000000 ]'
- name: check /boot space
shell:
cmd: '[ $(df --output="avail" /boot | tail -n 1) -gt 300000 ]'
- name: dist-upgrade current ubuntu
apt:
force_apt_get: true
install_recommends: false
update_cache: true
dpkg_options: force-confnew
upgrade: dist
register: apt_status
retries: 60
until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)
- name: autoremove current ubuntu
apt:
force_apt_get: true
install_recommends: false
autoclean: true
autoremove: true
register: apt_status
retries: 60
until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)
- name: list ubicast packages
shell:
cmd: |
rm -f /root/ubicast-installed;
for pkg in 'ubicast-mediaserver' 'ubicast-mediaserver-runtime' 'ubicast-monitor' 'ubicast-monitor-runtime' 'ubicast-skyreach' 'ubicast-skyreach-runtime' 'celerity-server' 'celerity-workers'; do
dpkg -s "$pkg" >/dev/null 2>&1 && echo -n "$pkg " | tee -a '/root/ubicast-installed';
echo '';
done
- name: dump mediaserver database
shell:
cmd: /usr/bin/mscontroller.py dump
- name: dump skyreach database
shell:
cmd: /home/skyreach/htdocs/skyreach_site/scripts/control.sh dump
- name: stop services
loop:
- nginx
- msmonitor
- mediaserver
- skyreach
systemd:
name: "{{ item }}"
state: stopped
- name: add debian keys
loop:
- https://ftp-master.debian.org/keys/archive-key-10.asc
- https://ftp-master.debian.org/keys/archive-key-10-security.asc
apt_key:
url: "{{ item }}"