From 05e6b2c2da86cc246cc77964462acf7ab68f5b32 Mon Sep 17 00:00:00 2001 From: Wilfried OLLIVIER Date: Thu, 2 Jul 2020 09:26:49 +0200 Subject: [PATCH] Bootstrap o2m role --- README.md | 28 ++++++++++++++++++++++++++++ defaults/main.yml | 13 +++++++++++++ meta/main.yml | 15 +++++++++++++++ tasks/main.yml | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/main.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..9ffc764 --- /dev/null +++ b/README.md @@ -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 } diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..d4b6178 --- /dev/null +++ b/defaults/main.yml @@ -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 diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..4e10daa --- /dev/null +++ b/meta/main.yml @@ -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: [] diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..c95910f --- /dev/null +++ b/tasks/main.yml @@ -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"