parent
0617923d4d
commit
02c8bc6f05
3 changed files with 58 additions and 0 deletions
|
@ -15,3 +15,4 @@
|
||||||
- {role: inbucket, tags: inbucket}
|
- {role: inbucket, tags: inbucket}
|
||||||
- {role: kms, tags: kms}
|
- {role: kms, tags: kms}
|
||||||
- {role: swarm_dashboard, tags: swarm_dashboard}
|
- {role: swarm_dashboard, tags: swarm_dashboard}
|
||||||
|
- {role: shephard, tags: shephard}
|
||||||
|
|
42
ansible/roles/shephard/docker-stack.yml
Normal file
42
ansible/roles/shephard/docker-stack.yml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: mazzolino/shepherd
|
||||||
|
environment:
|
||||||
|
TZ: 'Europe/Amsterdam'
|
||||||
|
FILTER_SERVICES: ''
|
||||||
|
IGNORELIST_SERVICES: ""
|
||||||
|
RUN_ONCE_AND_EXIT: "true"
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: /var/run/docker.sock
|
||||||
|
target: /var/run/docker.sock
|
||||||
|
read_only: true
|
||||||
|
deploy:
|
||||||
|
replicas: 0
|
||||||
|
restart_policy:
|
||||||
|
condition: none
|
||||||
|
labels:
|
||||||
|
- swarm.cronjob.enable=true
|
||||||
|
- "swarm.cronjob.schedule=0 2 * * *"
|
||||||
|
- swarm.cronjob.skip-running=true
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.role == manager
|
||||||
|
|
||||||
|
scheduler:
|
||||||
|
image: crazymax/swarm-cronjob:latest
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: /var/run/docker.sock
|
||||||
|
target: /var/run/docker.sock
|
||||||
|
read_only: true
|
||||||
|
environment:
|
||||||
|
- "TZ=Europe/Amsterdam"
|
||||||
|
- "LOG_LEVEL=info"
|
||||||
|
- "LOG_JSON=false"
|
||||||
|
deploy:
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.role == manager
|
15
ansible/roles/shephard/tasks/main.yml
Normal file
15
ansible/roles/shephard/tasks/main.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
- name: Create working directory
|
||||||
|
file:
|
||||||
|
path: /srv/shephard
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Copy Docker stack file
|
||||||
|
copy:
|
||||||
|
src: "{{ role_path }}/docker-stack.yml"
|
||||||
|
dest: /srv/shephard/docker-stack.yml
|
||||||
|
|
||||||
|
- name: Deploy Docker stack
|
||||||
|
docker_stack:
|
||||||
|
name: shephard
|
||||||
|
compose:
|
||||||
|
- /srv/shephard/docker-stack.yml
|
Reference in a new issue