communistquotes/ansible.yml

37 lines
1 KiB
YAML

---
- hosts: all
# Install python if required
# https://www.josharcher.uk/code/ansible-python-connection-failure-ubuntu-server-1604/
gather_facts: False
pre_tasks:
- name: install python for Ansible
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal python-setuptools)
args:
executable: /bin/bash
register: output
changed_when: output.stdout != ""
- setup: # gather facts
tasks:
- name: clone/update git repo
git:
repo: 'https://0xacab.org/radical_coder/pinko.red.git'
dest: /pinkored
- name: Build image using cache source
docker_image:
name: communistquotes:latest
build:
path: /pinkored/communistquotes/
pull: yes
source: build
- name: add all template files
template: src=env dest=/pinkored/env
- name: create crontab
cron:
name: "communist-quotes"
hour: "*/3"
job: "docker run -it --rm --name communistquotes --env-file /pinkored/env communistquotes >> /var/log/communistquotes.log 2>&1"