Refactor the playbook to support multiple roles per host nicely

This commit is contained in:
Waffles
2023-01-09 02:39:02 -08:00
parent 4f73bfcf2c
commit 4d0b70bbe1
20 changed files with 186 additions and 45 deletions
+17 -5
View File
@@ -5,6 +5,8 @@
name: mastodon
shell: /bin/bash
group: docker
tags:
- install
- name: Check if mastodon repo checked out
stat: path=/home/mastodon/live
@@ -14,19 +16,25 @@
when: not p.stat.exists
- name: Install statsd mapper
template:
src: statsd-mapping.yaml.j2
copy:
src: statsd-mapping.yaml
dest: /root/statsd-mapping.yml
tags:
- install
- name: Install .env.production file
template:
src: env.production.j2
dest: /home/mastodon/live/.env.production
tags:
- configure
- name: Install docker-compose.sh file
template:
src: docker-compose.sh.j2
copy:
src: docker-compose.sh
dest: /usr/local/bin/docker-compose.sh
tags:
- install
- name: Set permissions of docker-compose.sh
file:
@@ -37,12 +45,16 @@
template:
src: docker-compose.yml.j2
dest: /home/mastodon/live/docker-compose.yml
tags:
- configure
notify: "docker-compose up"
- name: Install feed rebuild script
template:
src: feeds-build.sh.j2
dest: /usr/local/bin/feeds-build.sh
tags:
- install
- name: Set permission of feeds-build.sh
file:
@@ -54,4 +66,4 @@
when: RUN_REDIS is defined and RUN_REDIS
- import_tasks: maintenance.yml
when: ansible_hostname == MAINTENANCE_HOST
when: RUN_CRONS is defined and RUN_CRONS
+31 -2
View File
@@ -1,8 +1,19 @@
---
- name: Install storage trimmer
template:
src: trim_storage.sh.j2
copy:
src: trim_storage.sh
dest: /usr/local/bin/trim_storage.sh
tags:
- install
register: trim_storage
- name: Set permissions on trim_storage.sh
file:
path: /usr/local/bin/trim_storage.sh
mode: '0755'
tags:
- install
when: trim_storage.changed
- name: Create cronjob for trimming storage
ansible.builtin.cron:
@@ -10,3 +21,21 @@
job: /usr/local/bin/trim_storage.sh
minute: "0"
hour: "*/6"
tags:
- configure
- name: Install image puller
copy:
src: pull-images.sh
dest: /usr/local/bin/pull-images.sh
tags:
- install
register: pull_images
- name: Set permissions on pull-images.sh
file:
path: /usr/local/bin/pull-images.sh
mode: '0755'
tags:
- install
when: pull_images.changed
+9
View File
@@ -2,17 +2,26 @@
sysctl:
name: vm.overcommit_memory
value: '1'
tags:
- redis
- name: Install system redis
package:
name: redis-server
state: present
tags:
- install
- redis
- name: Set redis.conf
copy:
dest: /etc/redis/redis.conf
src: redis-6.conf
register: service_conf
tags:
- install
- configure
- redis
- name: Restart redis
service:
-1
View File
@@ -4,4 +4,3 @@
repo: https://github.com/mastodon/mastodon.git
dest: /home/mastodon/live
version: "{{ MASTODON_VERSION }}"