Bootstrap o2m role

This commit is contained in:
Wilfried OLLIVIER 2020-07-02 09:26:49 +02:00
commit 05e6b2c2da
4 changed files with 90 additions and 0 deletions

28
README.md Normal file
View file

@ -0,0 +1,28 @@
# galaxy-o2m
Install o2m from Docker hub images
## Requirements
Docker running on the target host
## Role Variables
- o2m_name: name of the o2m instance
- o2m_data: data dir for o2m instances
- o2m_version: pinned version of o2m
- o2m_discord_token: bot token from Discord
- o2m_feed_urls: comma separated list of Podcast RSS feeds to watch
- o2m_nickname: nickname (or display name) for this current bot instance
- o2m_guild_id: guild id for current o2m instance
- o2m_timer: time between each check
## Dependencies
None
## Example Playbook
- hosts: servers
roles:
- { role: galaxy-o2m, o2m_discord_token: XXXXXX, o2m_guild_id: XXXXXX, o2m_feed_urls: https://podcast.example.com/rss, o2m_name: example }

13
defaults/main.yml Normal file
View file

@ -0,0 +1,13 @@
---
# defaults file for galaxy-o2m
o2m_base: "/srv/o2m"
o2m_dets_uid: 1000
o2m_dets_gid: 1000
o2m_name: example
o2m_version: 0.3.4
o2m_timer: 300

15
meta/main.yml Normal file
View file

@ -0,0 +1,15 @@
galaxy_info:
author: Wilfried OLLIVIER
description: Install o2m using Docker
company: none
license: WTFPL
min_ansible_version: 2.9
platforms:
- name: Debian
versions:
- Buster
dependencies: []

34
tasks/main.yml Normal file
View file

@ -0,0 +1,34 @@
---
# tasks file for galaxy-o2m
- name: Ensure o2m data dir
file:
path: "{{ o2m_base }}"
state: directory
- name: Ensure o2m dets subdir
file:
path: "{{ o2m_base }}/{{ item }}"
state: directory
owner: "{{ o2m_dets_uid }}"
group: "{{ o2m_dets_gid }}"
with_items:
- "{{ o2m_name }}"
- "{{ o2m_name }}/dets"
- name: Ensure o2m (service)
docker_container:
name: o2m-{{ o2m_name }}
image: papey/o2m:{{ o2m_version }}
pull: yes
state: started
env:
DISCORD_TOKEN: "{{ o2m_discord_token }}"
O2M_FEED_URLS: "{{ o2m_feed_urls }}"
O2M_NICKNAME: "{{ o2m_nickname }}"
O2M_GUILD_ID: "{{ o2m_guild_id }}"
O2M_CHAN_ID: "{{ o2m_chan_id }}"
O2M_JOBS_TIMER: "{{ o2m_timer }}"
restart_policy: always
volumes:
- "{{ o2m_base }}/{{ o2m_name }}/dets:/opt/o2m/dets"