parent
0ab0ded253
commit
07afc5cc31
@ -1,150 +1,37 @@
|
|||||||
---
|
---
|
||||||
- name: try to update mojo directory
|
|
||||||
shell: cd /home/josiah/mojojojo-bot && git pull
|
|
||||||
register: result
|
|
||||||
ignore_errors: True
|
|
||||||
tags:
|
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: if the folder doesn't exist, clone from remote
|
# Update the mojo git repo
|
||||||
shell: cd /home/josiah/ && git clone http://git.awful.club/hosted/mojojojo-bot.git
|
- name: ensure the app folders exist
|
||||||
when: result is failed
|
file: state=directory path={{ item }} owner=josiah group=josiah mode=0700
|
||||||
tags:
|
loop: [ '/home/josiah/apps/mojo/', '/home/josiah/apps/arke/', '/home/josiah/apps/znc/', '/home/josiah/apps/awful/' ]
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: Build mojo from the latest version
|
|
||||||
shell: cd /home/josiah/mojojojo-bot/mojo-web && docker build -t mojo-web -f dockerfile .
|
|
||||||
tags:
|
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: Check if there are any existing mojo-web containers running and kill them
|
|
||||||
# this has to be a shell because command: isn't interactive
|
|
||||||
shell: docker ps | grep 'mojo-web' | awk '{print $1}' | xargs docker kill
|
|
||||||
ignore_errors: True
|
|
||||||
tags:
|
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
|
|
||||||
- name: Run the newly built mojo-web docker container
|
|
||||||
command: docker container run -e "SLACK_BOT_TOKEN={{ slack_bot_token }}" --restart "always" -d --mount type="bind",source="/mnt/volume_sfo2_znc",target=/shared/ mojo-web
|
|
||||||
tags:
|
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
|
|
||||||
- name: Build mojo-rtm from the latest version
|
|
||||||
shell: cd /home/josiah/mojojojo-bot/mojo-rtm && docker build -t mojo-rtm -f dockerfile .
|
|
||||||
tags:
|
|
||||||
- mojo
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: Check if there are any existing mojo-rtm containers running and kill them
|
|
||||||
# this has to be a shell because command: isn't interactive
|
|
||||||
shell: docker ps | grep 'mojo-rtm' | awk '{print $1}' | xargs docker kill
|
|
||||||
ignore_errors: True
|
|
||||||
tags:
|
|
||||||
- mojo
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: Run the newly built mojo-rtm docker container
|
|
||||||
command: docker container run -e "SLACK_BOT_TOKEN={{ slack_bot_token }}" --restart "always" -d --mount type="bind",source="/mnt/volume_sfo2_znc",target=/shared/ mojo-rtm
|
|
||||||
tags:
|
|
||||||
- mojo
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: update or create the ZNC directory
|
|
||||||
shell: cd /home/josiah/znc-docker/ && git pull
|
|
||||||
register: result
|
|
||||||
ignore_errors: True
|
|
||||||
|
|
||||||
# if the folder doesn't exist, clone source.
|
|
||||||
- shell: cd /home/josiah && git clone https://github.com/jowj/znc-docker.git
|
|
||||||
when: result is failed
|
|
||||||
- name: build from latest version
|
|
||||||
shell: cd /home/josiah/znc-docker/full && docker build -t znc -f Dockerfile .
|
|
||||||
- name: Check if there are any existing ZNC containers running and kill it
|
|
||||||
shell: docker ps | grep 'znc' | awk '{print $1}'
|
|
||||||
register: result
|
|
||||||
- name: if there are running containers, remove them
|
|
||||||
shell: docker ps | grep 'znc' | awk '{print $1}' | xargs docker kill
|
|
||||||
when: result.stdout != ""
|
|
||||||
- name: discover if any containers with ZNC in name
|
|
||||||
# this has to be a shell because command: isn't interactive
|
|
||||||
shell: docker container ls | grep 'znc'
|
|
||||||
register: result
|
|
||||||
ignore_errors: True
|
|
||||||
- name: remove any existing containers with ZNC in name
|
|
||||||
shell: docker container rm znc
|
|
||||||
when: result is succeeded
|
|
||||||
- name: run the container (assumes the volume is already set up)
|
|
||||||
command: docker run --restart "always" -d -p 5000:5000 --mount type="bind",source="/mnt/volume_sfo2_znc/",target=/znc-data znc
|
|
||||||
|
|
||||||
|
|
||||||
- name: update arke repo
|
|
||||||
shell: cd /home/josiah/arke/ && git pull
|
|
||||||
register: result
|
|
||||||
ignore_errors: True
|
|
||||||
tags:
|
|
||||||
- arke
|
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: If last step failed, clone the repo.
|
|
||||||
shell: cd /home/josiah/ && git clone https://git.awful.club/hosted/arke.git
|
|
||||||
when: result is failed
|
|
||||||
tags:
|
|
||||||
- arke
|
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: Build from the latest version
|
|
||||||
shell: cd /home/josiah/arke/ && docker build -t arke -f dockerfile .
|
|
||||||
tags:
|
|
||||||
- arke
|
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
- mojo-rtm
|
|
||||||
|
|
||||||
- name: Check if there are any existing arke containers running
|
- name: update the mojo git repo
|
||||||
shell: docker ps | grep 'arke' | awk '{print $1}'
|
git:
|
||||||
register: result
|
repo: 'https://git.awful.club/hosted/mojojojo-bot.git'
|
||||||
tags:
|
dest: /home/josiah/apps/mojo/
|
||||||
- arke
|
version: master
|
||||||
- mojo
|
|
||||||
- mojo-web
|
- name: update the arke git repo
|
||||||
- mojo-rtm
|
git:
|
||||||
|
repo: 'https://git.awful.club/hosted/arke.git'
|
||||||
- name: and kill it
|
dest: /home/josiah/apps/arke/
|
||||||
# this has to be a shell because command: isn't interactive
|
version: master
|
||||||
shell: docker ps | grep 'arke' | awk '{print $1}' | xargs docker kill
|
|
||||||
when: result.stdout != ""
|
- name: update the znc git repo
|
||||||
tags:
|
git:
|
||||||
- arke
|
repo: 'https://git.awful.club/hosted/znc-docker.git'
|
||||||
- mojo
|
dest: /home/josiah/apps/znc/
|
||||||
- mojo-web
|
version: master
|
||||||
- mojo-rtm
|
|
||||||
|
- name: copy over awful-All compose file
|
||||||
- name: Remove any existing containers using the arke name, its mine and i must have it
|
template:
|
||||||
# this has to be a shell because command: isn't interactive
|
src: "{{ item.src }}"
|
||||||
shell: docker container rm arke
|
dest: "{{ item.dest }}"
|
||||||
ignore_errors: True
|
mode: 0777
|
||||||
tags:
|
with_items:
|
||||||
- arke
|
- {src: 'awful-compose.yml', dest: '/home/josiah/apps/awful/docker-compose.yml'}
|
||||||
- mojo
|
|
||||||
- mojo-web
|
- name: Deploy awful stack
|
||||||
- mojo-rtm
|
docker_compose:
|
||||||
|
state: present
|
||||||
- name: Run the newly built docker container
|
project_src: "/home/josiah/apps/awful/"
|
||||||
command: docker run -d --name arke --mount type="bind",source="/mnt/volume_sfo2_znc",target=/shared/ arke:latest
|
|
||||||
tags:
|
|
||||||
- arke
|
|
||||||
- mojo
|
|
||||||
- mojo-web
|
|
||||||
- mojo-rtm
|
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mojo-web:
|
||||||
|
build:
|
||||||
|
context: /home/josiah/apps/mojo/mojo-web/
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: mojo-web
|
||||||
|
|
||||||
|
environment:
|
||||||
|
SLACK_BOT_TOKEN: {{ slack_bot_token }}
|
||||||
|
volumes:
|
||||||
|
- /mnt/volume_sfo2_znc/:/shared/
|
||||||
|
|
||||||
|
mojo-rtm:
|
||||||
|
build:
|
||||||
|
context: /home/josiah/apps/mojo/mojo-rtm/
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: mojo-rtm
|
||||||
|
environment:
|
||||||
|
SLACK_BOT_TOKEN: {{ slack_bot_token }}
|
||||||
|
volumes:
|
||||||
|
- /mnt/volume_sfo2_znc/:/shared/
|
||||||
|
|
||||||
|
arke:
|
||||||
|
build:
|
||||||
|
context: /home/josiah/apps/arke/
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: arke
|
||||||
|
volumes:
|
||||||
|
- /mnt/volume_sfo2_znc/:/shared/
|
||||||
|
|
||||||
|
znc:
|
||||||
|
build:
|
||||||
|
context: /home/josiah/apps/znc/
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: znc
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
volumes:
|
||||||
|
- /mnt/volume_sfo2_znc/:/znc-data
|
Loading…
Reference in new issue