Playbook to upgrade containers
Moved Ansible host requirements to 'ansible' role and created role 'upgrade' and playbook to help with upgrading containers.
This commit is contained in:
parent
efb29a2c37
commit
f1917f6a40
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,5 @@
|
|||||||
/*.yml
|
/*.yml
|
||||||
/*.yaml
|
/*.yaml
|
||||||
!moxie.yml
|
!moxie.yml
|
||||||
|
!upgrade-moxie.yml
|
||||||
/environments/
|
/environments/
|
||||||
|
21
moxie.yml
21
moxie.yml
@ -15,27 +15,8 @@
|
|||||||
- name: Install Moxie Server
|
- name: Install Moxie Server
|
||||||
hosts: moxietest
|
hosts: moxietest
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
# Install host requirements for playbooks
|
|
||||||
pre_tasks:
|
|
||||||
|
|
||||||
- name: 'Install Ansible dependency: python-apt'
|
|
||||||
shell: 'apt-get update && apt-get install python-apt -y'
|
|
||||||
args:
|
|
||||||
creates: /usr/lib/python2.7/dist-packages/apt
|
|
||||||
warn: false
|
|
||||||
|
|
||||||
- name: 'Install Ansible dependency: aptitude'
|
|
||||||
apt:
|
|
||||||
name: 'aptitude'
|
|
||||||
state: present
|
|
||||||
force_apt_get: true
|
|
||||||
|
|
||||||
- name: 'Install Ansible dependency: python-docker'
|
|
||||||
apt:
|
|
||||||
name: python-docker
|
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
|
- ansible
|
||||||
- docker
|
- docker
|
||||||
- traefik
|
- traefik
|
||||||
- wordpress
|
- wordpress
|
||||||
|
16
roles/ansible/tasks/main.yml
Normal file
16
roles/ansible/tasks/main.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
- name: 'Install Ansible dependency: python-apt'
|
||||||
|
shell: 'apt-get update && apt-get install python-apt -y'
|
||||||
|
args:
|
||||||
|
creates: /usr/lib/python2.7/dist-packages/apt
|
||||||
|
warn: false
|
||||||
|
|
||||||
|
- name: 'Install Ansible dependency: aptitude'
|
||||||
|
apt:
|
||||||
|
name: 'aptitude'
|
||||||
|
state: present
|
||||||
|
force_apt_get: true
|
||||||
|
|
||||||
|
- name: 'Install Ansible dependency: python-docker'
|
||||||
|
apt:
|
||||||
|
name: python-docker
|
||||||
|
state: present
|
38
roles/upgrade/tasks/main.yml
Normal file
38
roles/upgrade/tasks/main.yml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
- name: Download new Traefik container
|
||||||
|
docker_image:
|
||||||
|
name: "traefik:{{ traefik_version }}"
|
||||||
|
source: pull
|
||||||
|
register: new_traefik
|
||||||
|
|
||||||
|
- name: Download new WordPress container
|
||||||
|
docker_image:
|
||||||
|
name: "wordpress:{{ wordpress_version }}"
|
||||||
|
source: pull
|
||||||
|
register: new_wordpress
|
||||||
|
|
||||||
|
- name: Download new MariaDB container
|
||||||
|
docker_image:
|
||||||
|
name: "mariadb:{{ mariadb_version }}"
|
||||||
|
source: pull
|
||||||
|
register: new_mariadb
|
||||||
|
|
||||||
|
- name: Stop and remove old Traefik container
|
||||||
|
docker_container:
|
||||||
|
name: "{{ traefik_name }}"
|
||||||
|
image: "traefik:{{ traefik_version }}"
|
||||||
|
state: absent
|
||||||
|
when: new_traefik.changed
|
||||||
|
|
||||||
|
- name: Stop and remove old WordPress container
|
||||||
|
docker_container:
|
||||||
|
name: "{{ wordpress_name }}"
|
||||||
|
image: "wordpress:{{ wordpress_version }}"
|
||||||
|
state: absent
|
||||||
|
when: new_wordpress.changed
|
||||||
|
|
||||||
|
- name: Stop and remove old MariaDB container
|
||||||
|
docker_container:
|
||||||
|
name: "{{ mariadb_name }}"
|
||||||
|
image: "mariadb:{{ mariadb_version }}"
|
||||||
|
state: absent
|
||||||
|
when: new_mariadb.changed
|
7
upgrade-moxie.yml
Normal file
7
upgrade-moxie.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
- name: Upgrade Moxie Server
|
||||||
|
hosts: moxietest
|
||||||
|
become: true
|
||||||
|
roles:
|
||||||
|
- upgrade
|
||||||
|
- traefik
|
||||||
|
- wordpress
|
Loading…
x
Reference in New Issue
Block a user