ansible/playbooks/home_app.yml

122 lines
3.8 KiB
YAML
Raw Normal View History

#!/usr/bin/env ansible-playbook
# vim:ft=ansible:
# Webservers
---
- hosts: vm-bot-1.home.mgmt.desu.ltd
module_defaults:
docker_container:
state: started
restart_policy: unless-stopped
pull: yes
tasks:
- name: include tasks for applications
include_tasks: tasks/{{ item }}
with_items:
- app/gulagbot.yml
2021-12-21 11:16:40 -06:00
- app/ddclient.yml
tags: [ always ]
roles:
- role: backup
vars:
backup_s3backup_list_extra:
- /data
tags: [ backup ]
2021-12-30 09:31:07 -06:00
- hosts: vm-scan-1.home.mgmt.desu.ltd
module_defaults:
docker_container:
state: started
restart_policy: unless-stopped
pull: yes
pre_tasks:
- name: ensure docker network
docker_network: name=web
tags: [ docker ]
tasks:
- name: include tasks for applications
include_tasks: tasks/{{ item }}
with_items:
- app/gvm.yml
tags: [ always ]
2021-11-20 18:29:31 -06:00
- hosts: vm-syncthing-1.home.mgmt.desu.ltd
module_defaults:
docker_container:
state: started
restart_policy: unless-stopped
pull: yes
pre_tasks:
- name: ensure docker network
docker_network: name=web
tags: [ docker ]
2021-11-20 18:29:31 -06:00
tasks:
- name: assure nfs mount directory
file: path=/data/syncthing/data state=directory mode=0755
tags: [ storage ]
- name: assure nfs mount
mount: path=/data/syncthing/data src=vm-fs-1.home.mgmt.desu.ltd:/nfs/syncthing fstype=nfs4 opts="rsize=10248576,wsize=1048576,soft,timeo=600,retrans=2,_netdev" state=mounted
tags: [ storage ]
- name: include tasks for applications
include_tasks: tasks/{{ item }}
with_items:
- app/syncthing.yml
tags: [ always ]
- name: assure movement cronjobs
cron:
name: "{{ item.name }}"
minute: 0
hour: 5
job: "rsync -avHS --remove-source-files '/data/syncthing/data/{{ item.src }}/' '/data/syncthing/data/{{ item.dest }}/' && rmdir '/data/syncthing/data/{{ item.src }}' "
with_items:
# This works around a bug in my Android app lol
- name: husky test workaround
src: Pictures/Husky Test
dest: Pictures/Unsorted/Husky
- name: move messaging to unsorted
src: Pictures/Messaging
dest: Pictures/Unsorted/Messaging
- name: move discord to unsorted
src: Pictures/Discord
dest: Pictures/Unsorted/Discord
- name: move camera roll to unsorted
src: Pictures/Camera Roll
dest: Pictures/Unsorted/Camera Roll
- name: move cp2077 to screenshots
src: Pictures/Cyberpunk 2077
dest: Pictures/Screenshots/Vidya/Cyberpunk 2077
tags: [ cron ]
- name: assure zone identifier cleanup cronjob
cron:
name: cleanup zone.identtifier
minute: 0
hour: 3
job: 'find /data/syncthing/data/ -type f -iname "*:Zone.Identifier" -delete'
tags: [ cron ]
2021-12-16 08:11:17 -06:00
- name: assure filename sanitize cronjobs
cron:
2021-12-16 08:11:17 -06:00
name: "sanitize {{ item }}"
minute: 0
hour: 4
2021-12-16 08:11:17 -06:00
job: 'find /data/syncthing/data/ -type f -iname "*{{ item }}" | while read line; do mv "$line" "${line%{{ item }}}"; done'
with_items:
- ?name=orig.png
- ?name=orig.jpeg
tags: [ cron ]
2021-11-20 18:29:31 -06:00
roles:
- role: backup
vars:
backup_s3backup_list_extra:
- /data/syncthing/config
tags: [ backup ]
- role: ingress
vars:
ingress_container_image: "nginx:latest"
ingress_container_ports:
- 80:80
ingress_container_config_mount: /etc/nginx/conf.d
ingress_container_persist_dir: /data/nginx
ingress_listen_args: 80
ingress_listen_tls: no
ingress_servers:
- name: syncthing.local.desu.ltd
proxy_pass: http://syncthing:8384
tags: [ ingress ]