Change ansible config, move files into templates folder
This commit is contained in:
parent
97b7a6e491
commit
ef3e5a1e20
5 changed files with 20 additions and 9 deletions
29
ansible.yml
29
ansible.yml
|
@ -14,28 +14,39 @@
|
||||||
- setup: # gather facts
|
- setup: # gather facts
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
# TODO: this approach sucks because it always deploys from current master, instead of the local files
|
- name: create folder for build files
|
||||||
- name: clone/update git repo
|
file: path=/tmp/communistquotes state=directory
|
||||||
git:
|
|
||||||
repo: 'https://0xacab.org/radical_coder/pinko.red.git'
|
- name: copy build files
|
||||||
dest: /pinkored
|
copy: src=templates/{{item.filename}} dest=/tmp/communistquotes/{{item.filename}}
|
||||||
|
with_items:
|
||||||
|
- { filename: 'Dockerfile' }
|
||||||
|
- { filename: 'main.py' }
|
||||||
|
- { filename: 'marxistquotes.csv' }
|
||||||
|
- { filename: 'requirements.txt' }
|
||||||
|
|
||||||
- name: Build image using cache source
|
- name: Build image using cache source
|
||||||
docker_image:
|
docker_image:
|
||||||
name: communistquotes:latest
|
name: communistquotes:latest
|
||||||
build:
|
build:
|
||||||
path: /pinkored/communistquotes/
|
path: /tmp/communistquotes
|
||||||
pull: yes
|
pull: yes
|
||||||
source: build
|
source: build
|
||||||
force_source: yes
|
force_source: yes
|
||||||
force_tag: yes
|
force_tag: yes
|
||||||
|
|
||||||
- name: add all template files
|
- name: delete build files
|
||||||
template: src=env dest=/pinkored/env
|
file: path=/tmp/communistquotes state=absent
|
||||||
|
|
||||||
|
- name: create config folder
|
||||||
|
file: path=/etc/communistquotes state=directory mode=700
|
||||||
|
|
||||||
|
- name: add env file
|
||||||
|
copy: src=env dest=/etc/communistquotes/env mode=600
|
||||||
|
|
||||||
- name: create crontab
|
- name: create crontab
|
||||||
cron:
|
cron:
|
||||||
name: "communist-quotes"
|
name: "communist-quotes"
|
||||||
hour: "*/3"
|
hour: "*/3"
|
||||||
minute: "0"
|
minute: "0"
|
||||||
job: "perl -le 'sleep rand 10800' && docker run --rm --name communistquotes --env-file /pinkored/env communistquotes >> /var/log/communistquotes.log 2>&1"
|
job: "perl -le 'sleep rand 10800' && docker run --rm --name communistquotes --env-file /etc/communistquotes/env communistquotes >> /var/log/communistquotes.log 2>&1"
|
||||||
|
|
Loading…
Reference in a new issue