From 6b3ad7f286787fcd5b65f9782ca590be4e3cd767 Mon Sep 17 00:00:00 2001 From: Laur Ivan Date: Fri, 9 Jun 2023 15:41:22 +0200 Subject: [PATCH] Initial commit --- .ansible-lint | 10 ++++ .gitattributes | 3 ++ .github/FUNDING.yml | 2 + .github/ISSUE_TEMPLATE/bug_report.md | 49 ++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 3 ++ .github/ISSUE_TEMPLATE/feature_request.md | 31 ++++++++++++ .github/ISSUE_TEMPLATE/refactor.md | 27 ++++++++++ .github/ISSUE_TEMPLATE/support_request.md | 27 ++++++++++ .github/stale.yml | 33 ++++++++++++ .gitignore | 15 ++++++ .travis.yml | 25 +++++++++ .yamllint | 33 ++++++++++++ CHANGELOG.md | 18 +++++++ LICENSE | 10 ++++ README.md | 47 +++++++++++++++++ ansible.cfg | 11 ++++ defaults/main.yml | 40 +++++++++++++++ files/metadata.db | Bin 0 -> 413696 bytes handlers/main.yml | 2 + meta/main.yml | 25 +++++++++ molecule/default/cleanup.yml | 27 ++++++++++ molecule/default/converge.yml | 5 ++ molecule/default/destroy.yml | 27 ++++++++++ molecule/default/molecule.yml | 38 ++++++++++++++ molecule/default/prepare.yml | 45 +++++++++++++++++ molecule/default/tests/test_app.yml | 12 +++++ molecule/default/verify.yml | 59 ++++++++++++++++++++++ molecule/requirements.yml | 6 +++ tasks/config.yml | 34 +++++++++++++ tasks/install.yml | 7 +++ tasks/main.yml | 11 ++++ templates/docker-compose.yml.j2 | 21 ++++++++ templates/env.calibre.conf.j2 | 13 +++++ test-requirements.txt | 6 +++ 34 files changed, 722 insertions(+) create mode 100644 .ansible-lint create mode 100644 .gitattributes create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/refactor.md create mode 100644 .github/ISSUE_TEMPLATE/support_request.md create mode 100644 .github/stale.yml create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 .yamllint create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 ansible.cfg create mode 100644 defaults/main.yml create mode 100644 files/metadata.db create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 molecule/default/cleanup.yml create mode 100644 molecule/default/converge.yml create mode 100644 molecule/default/destroy.yml create mode 100644 molecule/default/molecule.yml create mode 100644 molecule/default/prepare.yml create mode 100644 molecule/default/tests/test_app.yml create mode 100644 molecule/default/verify.yml create mode 100644 molecule/requirements.yml create mode 100644 tasks/config.yml create mode 100644 tasks/install.yml create mode 100644 tasks/main.yml create mode 100644 templates/docker-compose.yml.j2 create mode 100644 templates/env.calibre.conf.j2 create mode 100644 test-requirements.txt diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..355eeac --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,10 @@ +--- +exclude_paths: + - ./molecule + - ./.travis.yml + - ./.github +parseable: true +skip_list: + - '204' +use_default_rules: true +verbosity: 1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d08e2bf --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.yml linguist-detectable=true +*.yaml linguist-detectable=true +*.html linguist-detectable=false diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..2da2ded --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: equinoxel +patreon: laurivan \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..960f91b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,49 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG]" +labels: bug +assignees: '' + +--- + + + +### Description + +[Description of the issue] + +### Steps to Reproduce + +1. [First Step] +2. [Second Step] +3. [and so on...] + +**Expected behavior:** +[What you expect to happen] + +**Actual behavior:** +[What actually happens] + +**Reproduces how often:** +[What percentage of the time does it reproduce?] + +### Environment + +- The release version/s you are using: +- OS: +- Ansible Version: +- Python Version: +- Others: +### Additional Information + +[Any additional information, configuration or data that might be necessary to reproduce the issue.] diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..f3aad96 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,3 @@ +--- + +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..9b2e2d9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,31 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[FEATURE]" +labels: enhancement +assignees: '' + +--- + + + +### Description + +[Description of the issue] + +### Why is this needed? + +[A clear and concise description of why do you think this is needed] + +### Additional Information + +[Any additional information, configuration or data.] diff --git a/.github/ISSUE_TEMPLATE/refactor.md b/.github/ISSUE_TEMPLATE/refactor.md new file mode 100644 index 0000000..8d7bff6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/refactor.md @@ -0,0 +1,27 @@ +--- +name: Refactor +about: Found anything to refactor in this project? +title: "[REFACTOR]" +labels: clean-up +assignees: '' + +--- + + + +### Description + +[Description of the issue] + +### Link/s to the specific code that needs a refactor (if applicable) + +[Links] \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 0000000..a5a9e07 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -0,0 +1,27 @@ +--- +name: Support Request +about: Support request or question about this project +title: "[SUPPORT]" +labels: question +assignees: '' + +--- + + + +### Description + +[Description of the issue] + +### Additional Information + +Any additional information, configuration or data that might be necessary to reproduce the issue. \ No newline at end of file diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..c765ed1 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,33 @@ +--- +issues: + # Number of days of inactivity before an issue becomes stale + daysUntilStale: 90 + # Number of days of inactivity before a stale issue is closed + daysUntilClose: 7 + # Issues with these labels will never be considered stale + exemptLabels: + - "pinned" + - "security" + - "good first issue" + # Label to use when marking an issue as stale + staleLabel: wontfix + # Comment to post when marking an issue as stale. Set to `false` to disable + markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. + # Comment to post when closing a stale issue. Set to `false` to disable + closeComment: false + +pulls: + # Number of days of inactivity before a pull request becomes stale + daysUntilStale: 90 + # Number of days of inactivity before a stale pull request is closed + daysUntilClose: 7 + # Comment to post when marking a pull request as stale. Set to `false` to disable + markComment: > + This pull request has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. + # Comment to post when closing a stale pull request. Set to `false` to disable + closeComment: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2100e33 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ + +tests/playbook.retry +tests/.cache +__pycache__ +.pytest_cache +.molecule +.cache +.venv + +*.iml +.idea +.project + +*.pyc +**/.vscode \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9ff0334 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +--- +dist: xenial +language: python +python: "3.9" +os: linux +services: + - docker +install: + - pip install -I pipenv + - pipenv sync +env: + jobs: + - MOLECULE_DISTRO=debian:buster-slim + - MOLECULE_DISTRO=debian:bullseye-slim +script: + - pipenv run molecule test --all + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ + email: + if: branch = main + on_success: change + on_failure: always + recipients: + - laur.ivan@gmail.com diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..80f524b --- /dev/null +++ b/.yamllint @@ -0,0 +1,33 @@ +--- +# Based on ansible-lint config +extends: default + +ignore: | + molecule/**/tests/ + .venv + .github + .travis.yml + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + colons: + max-spaces-after: -1 + level: error + commas: + max-spaces-after: -1 + level: error + empty-lines: + max: 3 + level: error + hyphens: + level: error + key-duplicates: enable + line-length: disable + new-lines: + type: unix + truthy: disable diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..fc58963 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ +# Change Log + +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). + +## [Unreleased](https://github.com/equinoxel/ansible-role-calibre/tree/develop) +### Changed +### Added +### Removed +### Fixed + +## [X.Y.Z](https://github.com/equinoxel/ansible-role-calibre/tree/X.Y.Z) +### [Full Changelog](https://github.com/equinoxel/ansible-role-calibre/compare/1.0.0...X.Y.Z) +### Changed + *[#](https://github.com/equinoxel/ansible-role-calibre/issues/) \* @\ + +## [1.0.0](https://github.com/equinoxel/ansible-role-calibre/tree/1.0.0) +- Initial release diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1936a8d --- /dev/null +++ b/LICENSE @@ -0,0 +1,10 @@ +The MIT License (MIT) +===================== + +Copyright © 2023 Laur IVAN + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c64965c --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# Calibre Ansible role + +This role installs Calibre via Docker compose. + +## Requirements + +None + +## Role Variables + +All variables are listed below (see also `defaults/main.yml`). + +```yml +--- +``` + +## Dependencies + +You need a machine with docker and docker-compose installed. + +## Example Playbook + +```yml +- hosts: servers + roles: + - 'laurivan.calibre' +``` + +## License + +This project is licensed under the [MIT](https://opensource.org/licenses/MIT) license - see the [LICENSE](LICENSE) file for details. + +![MIT License](https://img.shields.io/badge/license-MIT%20License-brightgreen) + +## Author Information + +This role was created in 2023 by [Laur Ivan](https://www.laurivan.com). + +## Built With + +![Ansible](https://img.shields.io/badge/ansible-5.2.0-green.svg) +![Molecule](https://img.shields.io/badge/molecule-3.4.0-green.svg) +![Goss](https://img.shields.io/badge/goss-0.3.16-green.svg) + +## Contributing + +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..1c8d617 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,11 @@ +# Custom .cfg file +[defaults] +roles_path= ./cache/roles +collections_path= ./cache/collections +host_key_checking = false + +[privilege_escalation] +become = false + +[ssh_connection] +pipelining = True diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..4375617 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,40 @@ +--- + +## General +calibre_image: lscr.io/linuxserver/calibre-web:latest + +calibre_http_port: 8083 + +# Calibre paths +calibre_root_path: /var/local +calibre_data_base: "{{ calibre_root_path }}/calibre" +calibre_config_path: "{{ calibre_root_path }}/conf/calibre" + +# Calibre volumes +calibre_config_volume: "{{ calibre_data_base }}/calibre_config" +calibre_library_volume: "{{ calibre_data_base }}/calibre_library" +calibre_timezone: "Etc/UTC" + +calibre_user_id: +calibre_group_id: + +# Calibre-specific options + +calibre_has_convertor: false +calibre_relax_oauth: true + + +# Add other paths here to make sure they're created automatically +# +calibre_skeleton_paths: + - "{{ calibre_config_path }}" + - "{{ calibre_config_volume }}" + - "{{ calibre_library_volume }}" + +# Add more templates to be copied into the config +calibre_configuration_files: + - "docker-compose.yml" + - "env.calibre.conf" + +# Documentation +calibre_documentation_link: "https://www.laurivan.com" diff --git a/files/metadata.db b/files/metadata.db new file mode 100644 index 0000000000000000000000000000000000000000..fc0d5d3156ccaf85108d9bb797433e688e1f2136 GIT binary patch literal 413696 zcmeI5ZEzgPdEa*lV0Q_=>`^*seFvSc2}%N11WD}iKpu}rotD57ha-T5Wq)wWsU)RJ#b4r-D@i4(*d^yf%1OB@v0awR73YI1 zWmi(JxLlEJ$)}3bJ>4_YGduf&7wQhn|BAOSPrp9D=jo@rXL_K;cjk0UBP&L|qFUr^ zZST^T35zI4|rq^FL?Qa3W~jU$70tRu^ko3{_eQ|He|x0WRH)EdiW z-CWb^vV{V|!y!frWchg5$?eo$nQ9v*nmrs#-8tXhL~j55V<;d#vibJGc)rPt%!XY<_UzP~5ia*Dmj2dEx&0TpsA*^3Y z(I{!VtcT7T6~(BRw0cuTWIA^xyEIoI6Wa;BgvciK`st0#^h_d_x;@!`8V)f`Af#; z7)X}IulL7NCr?KC;zF!YOzpjfRxN6Qp94O#1QN$sU>K(*)9>f{;;B?B`fc4C*!D>7 z_m#Ir+>*AYAF)mu1l;q?L{b|OT{^NB5|wCobD7*xEColpY5a3&E+bei<|&9GO|6xl#9h()=*Qe zHUE6*sy{N)!5k}Pb=7Pd`)>J6hvJO}T|F>r9rCTICY?a;(!hUtetyoazLRars%a?| zqol9s8g0jQK4-n)Ry6X;#Kgp@i46TmCMI6D|DCkoN79>Dqw&=6aCEC;k7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cT%`yx?YxUIZI+tEa3_aa-DYpIp8K{s99njknlp88s}oehMlqVEE>w6K;* zXF6TG;xt8-p}>8M0Fj;D#Z>LCdX%xTqXRKiTt>7pJZ z7H$pSG;R;t?(MK2FFbJ-16=KZ7sj=#DAxtpMuXnO?b^ThBUf8PKh{=j&rWf~t|~Ni zIL~0e>Hjc=${<=4i(@90w4eaAOHd&00JPew*m(a5|_v2T&#<}VnSc9kgTyRr4Kalg09wUdWjxDrBA`I1E);y+jj;Z{rqHn zATsj{XUqC>U9CS*Y;TbrC+IC|nf`(43cW*0D-hQLJf%m9G{L(vA$lK>$~|_H+)lzL zTl%Eq= zITbkr@WMIQ%+0mi1`r!dWQhY7v2e)RUo*R-N#A0Km09rISub$WJ=)i&b9 z6o04f%NWkBGCPT%Bs6(~XCOOGn8yC@o@e4$=xmvHT$x_7yK`coKQePn?v}%vU$Ujq z^!A+>`}-r4$5!h`qo$P<`C{S2N6+{5N7Bbk^{$(unGYWg9q5moJl3E-;iyR~didzY zXn!O#MB_!-RMa{>6JDoGX+z8uZ2un}_^Sy0hZhKd00@9UFBAB~$iY}7z46a9`v`eBo}79MM9k{oU;VO?9qBRM=ix z_JST9c|}8L85nj~xtwks!qB_B&KA$y25PmVmfcPlH+zf5-R(S{sng3H&XDVLMmIQ& zKB5DMT*Clx`zHFb?mY-CyLzTGa0V^Zvz@!Xti2IuGwWU;a)XyQEwTsbdL?v?w~Sol p+lgEbwt&s9*bf + mount --move /tmp/docker_mounted.sock /var/run/docker.sock + become: true + changed_when: false + when: "not docker_sock_stat.stat.exists" + + - name: "CALIBRE | Update apt cache." + ansible.builtin.apt: update_cache=yes cache_valid_time=600 + when: "ansible_os_family == 'Debian'" + + - name: "CALIBRE | Install python requests" + ansible.builtin.pip: + name: + - "requests" + - "docker" + - "docker-compose" + + - name: "CALIBRE | Install docker" + vars: + docker_service_manage: false + ansible.builtin.include_role: + name: "geerlingguy.docker" diff --git a/molecule/default/tests/test_app.yml b/molecule/default/tests/test_app.yml new file mode 100644 index 0000000..38a1eea --- /dev/null +++ b/molecule/default/tests/test_app.yml @@ -0,0 +1,12 @@ +--- +## TODO: Remember to adapt goss tests to your convenience + + +## Check if ports are really exposed +# port: +# # Check port at IPv6 +# # https://github.com/aelsabbahy/goss/issues/177 +# tcp6:: +# listening: true +# ip: +# - '::' diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml new file mode 100644 index 0000000..081037f --- /dev/null +++ b/molecule/default/verify.yml @@ -0,0 +1,59 @@ +--- +# This is an example playbook to execute goss tests. +# Tests need distributed to the appropriate ansible host/groups +# prior to execution by `goss validate`. + +- name: Verify calibre + hosts: + - "calibre" + become: true + vars: + goss_version: "v0.3.16" + goss_arch: "amd64" + goss_dst: "/usr/local/bin/goss" + goss_sha256sum: "827e354b48f93bce933f5efcd1f00dc82569c42a179cf2d384b040d8a80bfbfb" + goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}" + goss_test_directory:" /tmp" + goss_format: "documentation" + + vars_files: + - ../../defaults/main.yml + + tasks: + - name: "CALIBRE | Download and install Goss" + get_url: + url: "{{ goss_url }}" + dest: "{{ goss_dst }}" + checksum: "sha256:{{ goss_sha256sum }}" + mode: 0755 + register: "download_goss" + until: "download_goss is succeeded" + retries: 3 + + - name: "CALIBRE | Copy Goss tests to remote" + template: + src: "{{ item }}" + dest: "{{ goss_test_directory }}/{{ item | basename }}" + with_fileglob: + - "tests/test_*.yml" + + - name: "CALIBRE | Register test files" + shell: "ls {{ goss_test_directory }}/test_*.yml" + register: "test_files" + + - name: "CALIBRE | Execute Goss tests" + command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}" + register: "test_results" + with_items: "{{ test_files.stdout_lines }}" + ignore_errors: true + + - name: "CALIBRE | Display details about the Goss results" + debug: + msg: "{{ item.stdout_lines }}" + with_items: "{{ test_results.results }}" + + - name: "CALIBRE | Fail when tests fail" + fail: + msg: "Goss failed to validate" + when: item.rc != 0 + with_items: "{{ test_results.results }}" diff --git a/molecule/requirements.yml b/molecule/requirements.yml new file mode 100644 index 0000000..11b02ca --- /dev/null +++ b/molecule/requirements.yml @@ -0,0 +1,6 @@ +--- +roles: + - "geerlingguy.docker" +collections: + - "community.general" + diff --git a/tasks/config.yml b/tasks/config.yml new file mode 100644 index 0000000..671de38 --- /dev/null +++ b/tasks/config.yml @@ -0,0 +1,34 @@ +--- +- name: "CALIBRE | Set up directories" + ansible.builtin.file: + state: directory + path: "{{ item }}" + owner: "{{ ansible_effective_user_id }}" + group: "{{ ansible_effective_group_id }}" + mode: "0755" + with_items: + - "{{ calibre_skeleton_paths }}" + tags: + - calibre_configure + become: true + +- name: "CALIBRE | Write configuration files" + ansible.builtin.template: + src: "{{ item }}.j2" + dest: "{{ calibre_config_path | expanduser | realpath }}/{{ item }}" + mode: '0640' + with_items: + - "{{ calibre_configuration_files }}" + tags: + - calibre_configure + +- name: "CALIBRE | Copy default database" + ansible.builtin.copy: + src: "{{ item }}" + dest: "{{ calibre_config_volume | expanduser | realpath }}/{{ item }}" + mode: '0644' + with_items: + - "metadata.db" + tags: + - calibre_configure + \ No newline at end of file diff --git a/tasks/install.yml b/tasks/install.yml new file mode 100644 index 0000000..85f4c9c --- /dev/null +++ b/tasks/install.yml @@ -0,0 +1,7 @@ +--- +- name: "CALIBRE | Ensure calibre is running" + community.docker.docker_compose: + project_src: "{{ calibre_config_path | expanduser | realpath }}" + build: false + tags: + - calibre_install diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..98483b3 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,11 @@ +--- + +- name: "CALIBRE | Configure" + import_tasks: config.yml + tags: + - calibre_configure + +- name: "CALIBRE | Install" + import_tasks: install.yml + tags: + - calibre_install diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 new file mode 100644 index 0000000..8bfc7c3 --- /dev/null +++ b/templates/docker-compose.yml.j2 @@ -0,0 +1,21 @@ +# calibre docker compose +version: '3.9' +services: + calibre: + image: "{{ calibre_image }}" + container_name: calibre-service + restart: always + env_file: + - "{{ calibre_config_path | expanduser }}/env.calibre.conf" + ports: + - "{{ calibre_http_port }}:8083" + # Add more ports if necessary + networks: + - calibre-net + # optional + volumes: + - "{{ calibre_config_volume }}:/config" + - "{{ calibre_library_volume }}:/books" + +networks: + calibre-net: {} \ No newline at end of file diff --git a/templates/env.calibre.conf.j2 b/templates/env.calibre.conf.j2 new file mode 100644 index 0000000..8463a3d --- /dev/null +++ b/templates/env.calibre.conf.j2 @@ -0,0 +1,13 @@ +# Add environment variables for calibre here +# Note: This is a .ini file format + +{% if calibre_user_id is defined and calibre_user_id != "" %}PUID={{ calibre_user_id }}{%endif%} +{% if calibre_group_id is defined and calibre_group_id != "" %}GUID={{ calibre_group_id }}{%endif%} +TZ={{ calibre_timezone }} +{% if calibre_has_convertor == true %} +DOCKER_MODS=linuxserver/mods:universal-calibre #optional +{% endif %} + +{% if calibre_relax_oauth == true %} +OAUTHLIB_RELAX_TOKEN_SCOPE=1 #optional +{% endif %} diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..a092e0c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,6 @@ +ansible-core==2.15.0 +ansible-compat==4.1.2 +molecule==5.0.1 +molecule-plugins[docker]==23.4.1 +molecule[lint]==1.16.0 +requests==2.28.1 \ No newline at end of file