Skip to content
Snippets Groups Projects
Commit bc3cac8e authored by Chris Croome's avatar Chris Croome
Browse files

Docker upgrade playbook added

parent 8d291b67
No related branches found
No related tags found
No related merge requests found
...@@ -26,22 +26,15 @@ ansible-playbook -u root discourse_upgrade.yml -i "${SERVERNAME}," -e "hostname= ...@@ -26,22 +26,15 @@ ansible-playbook -u root discourse_upgrade.yml -i "${SERVERNAME}," -e "hostname=
## Docker Upgrade ## Docker Upgrade
Every 3 months there is a new version of `docker-ce` released, the steps to upgrade (this could potentially be written as a Ansible Playbook: At least every 3 months there is a new version of `docker-ce` released, see the
[release notes](https://docs.docker.com/release-notes/docker-ce/), to upgrade
Docker CE use this playbook:
```bash ```bash
sudo -i export SERVERNAME="community.coops.tech"
su - discourse ansible-playbook -u root docker_upgrade.yml -i "${SERVERNAME}," -e "hostname=${SERVERNAME}"
cd /var/discourse
./launcher app stop
exit
apt-get update
apt-get upgrade
service docker status # check the uptime and that it is running
su - discourse
cd /var/discourse
./launcher app start
``` ```
## Discourse Install ## Discourse Install
Ansible Playbooks to install Ansible Playbooks to install
......
--- ---
- name: Install Discourse - name: Upgrade Discourse
hosts: "{{ hostname }}" hosts: "{{ hostname }}"
roles: roles:
......
---
- name: Upgrade Docker CE
hosts: "{{ hostname }}"
roles:
- docker-upgrade
---
- name: Stop the Discourse container
command: bash launcher stop app
args:
chdir: "/var/discourse"
become: yes
become_user: discourse
- name: Update apt package list
apt:
update_cache: yes
- name: Check if the Webarchitects logchange script is installed
command: which logchange
register: logchange
- block:
- name: Get a list of the updates
shell: "apt-show-versions -b -u | xargs"
register: apt_updates
- name: Record the updates in the /root/Changelog
command: 'logchange "{{ apt_updates.stdout }} : Updated"'
when: apt_updates.stdout != ""
when: logchange.stdout != ""
- name: Check if the Munin apt state file exists
stat:
path: "/var/lib/munin-node/plugin-state/nobody/plugin-apt.state"
register: munin_apt_state
- block:
- name: Delete the Munin apt state file
file:
dest: "/var/lib/munin-node/plugin-state/nobody/plugin-apt.state"
state: absent
- name: Update the Munin apt state file
command: munin-run apt_all
when: munin_apt_state.stat.exists == True
- name: Update all packages
apt:
upgrade: dist
autoclean: yes
- name: Restart Docker CE
service:
name: docker
state: restarted
- name: Start the Discourse container
command: bash launcher start app
args:
chdir: "/var/discourse"
become: yes
become_user: discourse
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment