-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create Membarr Docker Container with Default Variables The code changes include the addition of Membarr's default variables and the creation/removal of Docker container directories, and creating the Docker container. * Add discord token to Membarr configuration in settings.yml.default This commit adds a discord_token field to Membarr settings in defaults/settings.yml.default file. The configuration change enables users to set up their Discord bot token in Membarr. * "Refactor membarr (main): Update default Discord token usage" This commit refactors the membarr application to use the default Discord token. The docker run command has been updated to include new environment variables, and the role's main task now checks for a specified default Discord token and fails when not specified. * feat: Add membarr_paths_recursive and membarr_paths_config_location - Added membarr_paths_recursive variable to allow recursive creation of directories in membarr role. - Added membarr_paths_config_location variable to specify the location of config.ini file in membarr role. - Created new subtask settings.yml to handle all the settings related tasks in membarr role. - Added import task to include the settings.yml subtask in the main tasks of membarr role. - Created config.ini.j2 template file to define the configuration options for membarr.
- Loading branch information
1 parent
389f567
commit 4a89854
Showing
5 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
########################################################################## | ||
# Title: Sandbox: Membarr | Default Variables # | ||
# Author(s): CHAIR/Raneydazed # | ||
# URL: https://github.com/saltyorg/Sandbox # | ||
# -- # | ||
########################################################################## | ||
# GNU General Public License v3.0 # | ||
########################################################################## | ||
--- | ||
################################ | ||
# Basics | ||
################################ | ||
|
||
membarr_name: membarr | ||
|
||
################################ | ||
# Paths | ||
################################ | ||
|
||
membarr_paths_folder: "{{ membarr_name }}" | ||
membarr_paths_location: "{{ server_appdata_path }}/{{ membarr_paths_folder }}" | ||
membarr_paths_recursive: true | ||
membarr_paths_config_location: "{{ membarr_paths_location }}/config.ini" | ||
membarr_paths_folders_list: | ||
- "{{ membarr_paths_location }}" | ||
|
||
################################ | ||
# Docker | ||
################################ | ||
|
||
# Container | ||
membarr_docker_container: "{{ membarr_name }}" | ||
|
||
# Image | ||
membarr_docker_image_pull: true | ||
membarr_docker_image_tag: "latest" | ||
membarr_docker_image: "yoruio/membarr:{{ membarr_docker_image_tag }}" | ||
|
||
# Ports | ||
membarr_docker_ports_defaults: [] | ||
membarr_docker_ports_custom: [] | ||
membarr_docker_ports: "{{ membarr_docker_ports_defaults | ||
+ membarr_docker_ports_custom }}" | ||
|
||
# Envs | ||
membarr_docker_envs_default: | ||
TZ: "{{ tz }}" | ||
token: "{{ membarr.discord_token }}" | ||
membarr_docker_envs_custom: {} | ||
membarr_docker_envs: "{{ membarr_docker_envs_default | ||
| combine(membarr_docker_envs_custom) }}" | ||
|
||
# Commands | ||
membarr_docker_commands_default: [] | ||
membarr_docker_commands_custom: [] | ||
membarr_docker_commands: "{{ membarr_docker_commands_default | ||
+ membarr_docker_commands_custom }}" | ||
|
||
# Volumes | ||
membarr_docker_volumes_default: | ||
- "{{ membarr_paths_location }}:/app/app/config" | ||
membarr_docker_volumes_custom: [] | ||
membarr_docker_volumes: "{{ membarr_docker_volumes_default | ||
+ membarr_docker_volumes_custom }}" | ||
|
||
# Devices | ||
membarr_docker_devices_default: [] | ||
membarr_docker_devices_custom: [] | ||
membarr_docker_devices: "{{ membarr_docker_devices_default | ||
+ membarr_docker_devices_custom }}" | ||
|
||
# Hosts | ||
membarr_docker_hosts_default: [] | ||
membarr_docker_hosts_custom: [] | ||
membarr_docker_hosts: "{{ docker_hosts_common | ||
| combine(membarr_docker_hosts_default) | ||
| combine(membarr_docker_hosts_custom) }}" | ||
|
||
# Labels | ||
membarr_docker_labels_default: {} | ||
membarr_docker_labels_custom: {} | ||
membarr_docker_labels: "{{ docker_labels_common | ||
| combine(membarr_docker_labels_default) | ||
| combine(membarr_docker_labels_custom) }}" | ||
|
||
# Hostname | ||
membarr_docker_hostname: "{{ membarr_name }}" | ||
|
||
# Networks | ||
membarr_docker_networks_alias: "{{ membarr_name }}" | ||
membarr_docker_networks_default: [] | ||
membarr_docker_networks_custom: [] | ||
membarr_docker_networks: "{{ docker_networks_common | ||
+ membarr_docker_networks_default | ||
+ membarr_docker_networks_custom }}" | ||
|
||
# Capabilities | ||
membarr_docker_capabilities_default: [] | ||
membarr_docker_capabilities_custom: [] | ||
membarr_docker_capabilities: "{{ membarr_docker_capabilities_default | ||
+ membarr_docker_capabilities_custom }}" | ||
|
||
# Security Opts | ||
membarr_docker_security_opts_default: [] | ||
membarr_docker_security_opts_custom: [] | ||
membarr_docker_security_opts: "{{ membarr_docker_security_opts_default | ||
+ membarr_docker_security_opts_custom }}" | ||
|
||
# Restart Policy | ||
membarr_docker_restart_policy: always | ||
|
||
# State | ||
membarr_docker_state: started | ||
|
||
# User | ||
membarr_docker_user: "{{ uid }}:{{ gid }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
######################################################################### | ||
# Title: Sandbox: Membarr # | ||
# Author(s): CHAIR/Raneydazed # | ||
# URL: https://github.com/saltyorg/Sandbox # | ||
# -- # | ||
######################################################################### | ||
# GNU General Public License v3.0 # | ||
######################################################################### | ||
--- | ||
|
||
- name: Fail when default membarr.discord_token is specified | ||
ansible.builtin.fail: | ||
msg: "You must specify a Discord bot token in the settings under membarr.discord_token." | ||
when: (membarr.discord_token == 'your_discord_bot_token') and | ||
(not continuous_integration) | ||
|
||
- name: Remove existing Docker container | ||
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/remove_docker_container.yml" | ||
|
||
- name: Create directories | ||
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/directories/create_directories.yml" | ||
|
||
- name: Import Settings task | ||
ansible.builtin.import_tasks: "subtasks/settings.yml" | ||
|
||
- name: Create Docker container | ||
ansible.builtin.include_tasks: "{{ resources_tasks_path }}/docker/create_docker_container.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
########################################################################## | ||
# Title: Sandbox: Membarr # | ||
# Author(s): CHAIR/Raneydazed # | ||
# URL: https://github.com/saltyorg/Sandbox # | ||
# -- # | ||
########################################################################## | ||
# GNU General Public License v3.0 # | ||
########################################################################## | ||
--- | ||
- name: Set Default Plex instance | ||
ansible.builtin.set_fact: | ||
plex_name: "{{ plex_instances[0] }}" | ||
when: not plex_name is defined | ||
|
||
# Plex Tasks | ||
|
||
- name: "Settings | Check if '{{ plex_paths_config_location | basename }}' exists" | ||
ansible.builtin.stat: | ||
path: "{{ plex_paths_config_location }}" | ||
register: preferences_xml | ||
|
||
- name: Settings | {{ plex_name }} info tasks | ||
block: | ||
|
||
- name: Settings | Fetch {{ plex_name }} info | ||
community.general.xml: | ||
path: "{{ plex_paths_config_location }}" | ||
xpath: /Preferences | ||
content: attribute | ||
register: preferences_xml_resp | ||
ignore_errors: true | ||
|
||
- name: Settings | Register {{ plex_name }} Auth Token Value | ||
ansible.builtin.set_fact: | ||
plex_auth_token: "{{ preferences_xml_resp.matches[0].Preferences.PlexOnlineToken }}" | ||
|
||
- name: Settings | Register {{ plex_name }} Friendly Server Name | ||
ansible.builtin.set_fact: | ||
plex_friendly_name: "{{ preferences_xml_resp.matches[0].Preferences.FriendlyName }}" | ||
|
||
- name: Settings | Register {{ plex_name }} User Name | ||
ansible.builtin.set_fact: | ||
plex_online_username: "{{ preferences_xml_resp.matches[0].Preferences.PlexOnlineUsername }}" | ||
|
||
when: preferences_xml.stat.exists | ||
|
||
- name: Settings | Check if `{{ membarr_paths_config_location | basename }}` exists | ||
ansible.builtin.stat: | ||
path: "{{ membarr_paths_config_location }}" | ||
register: membarr_config | ||
|
||
- name: Settings | New `{{ membarr_paths_config_location | basename }}` tasks | ||
block: | ||
|
||
- name: Settings | Import default `{{ membarr_paths_config_location | basename }}` | ||
ansible.builtin.template: | ||
src: config.ini.j2 | ||
dest: "{{ membarr_paths_config_location }}" | ||
owner: "{{ user.name }}" | ||
group: "{{ user.name }}" | ||
mode: 0775 | ||
|
||
when: not membarr_config.stat.exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[bot_envs] | ||
Discord_bot_token = {{ membarr.discord_token }} | ||
{% if plex_auth_token is defined %} | ||
plex_base_url = {{ plex_web_url }} | ||
plex_token = {{ plex_auth_token }} | ||
plex_server_name = {{ plex_friendly_name }} | ||
plex_user = {{ plex_online_username }} | ||
{% endif %} | ||
plex_pass = | ||
plex_enabled = True | ||
plex_libs = all | ||
plex_roles = Add To Plex |