This commit is contained in:
commit
ea719292e5
159
.drone.jsonnet
Normal file
159
.drone.jsonnet
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
local PipelineLinting = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: 'linting',
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: 'amd64',
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'ansible-later',
|
||||||
|
image: 'thegeeklab/ansible-later',
|
||||||
|
commands: [
|
||||||
|
'ansible-later',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'python-format',
|
||||||
|
image: 'python:3.9',
|
||||||
|
environment: {
|
||||||
|
PY_COLORS: 1,
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'pip install -qq yapf',
|
||||||
|
'[ -z "$(find . -type f -name *.py)" ] || (yapf -rd ./)',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'python-flake8',
|
||||||
|
image: 'python:3.9',
|
||||||
|
environment: {
|
||||||
|
PY_COLORS: 1,
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'pip install -qq flake8',
|
||||||
|
'flake8',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineDeployment(scenario='rocky8') = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: 'testing-' + scenario,
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: 'amd64',
|
||||||
|
},
|
||||||
|
concurrency: {
|
||||||
|
limit: 1,
|
||||||
|
},
|
||||||
|
workspace: {
|
||||||
|
base: '/drone/src',
|
||||||
|
path: '${DRONE_REPO_NAME}',
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'ansible-molecule',
|
||||||
|
image: 'thegeeklab/molecule:3',
|
||||||
|
environment: {
|
||||||
|
HCLOUD_TOKEN: { from_secret: 'hcloud_token' },
|
||||||
|
},
|
||||||
|
commands: [
|
||||||
|
'molecule test -s ' + scenario,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
'linting',
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ['refs/heads/master', 'refs/tags/**'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineDocumentation = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: 'documentation',
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: 'amd64',
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'generate',
|
||||||
|
image: 'thegeeklab/ansible-doctor',
|
||||||
|
environment: {
|
||||||
|
ANSIBLE_DOCTOR_LOG_LEVEL: 'INFO',
|
||||||
|
ANSIBLE_DOCTOR_FORCE_OVERWRITE: true,
|
||||||
|
ANSIBLE_DOCTOR_EXCLUDE_FILES: 'molecule/',
|
||||||
|
ANSIBLE_DOCTOR_TEMPLATE: 'hugo-book',
|
||||||
|
ANSIBLE_DOCTOR_ROLE_NAME: '${DRONE_REPO_NAME#*.}',
|
||||||
|
ANSIBLE_DOCTOR_OUTPUT_DIR: '_docs/',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'publish',
|
||||||
|
image: 'plugins/gh-pages',
|
||||||
|
settings: {
|
||||||
|
remote_url: 'https://gitea.rknet.org/ansible/${DRONE_REPO_NAME}',
|
||||||
|
netrc_machine: 'gitea.rknet.org',
|
||||||
|
username: { from_secret: 'gitea_username' },
|
||||||
|
password: { from_secret: 'gitea_token' },
|
||||||
|
pages_directory: '_docs/',
|
||||||
|
target_branch: 'docs',
|
||||||
|
},
|
||||||
|
when: {
|
||||||
|
ref: ['refs/heads/master'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'],
|
||||||
|
},
|
||||||
|
depends_on: [
|
||||||
|
'testing-rocky8',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
local PipelineNotification = {
|
||||||
|
kind: 'pipeline',
|
||||||
|
name: 'notification',
|
||||||
|
platform: {
|
||||||
|
os: 'linux',
|
||||||
|
arch: 'amd64',
|
||||||
|
},
|
||||||
|
clone: {
|
||||||
|
disable: true,
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: 'matrix',
|
||||||
|
image: 'thegeeklab/drone-matrix',
|
||||||
|
settings: {
|
||||||
|
homeserver: { from_secret: 'matrix_homeserver' },
|
||||||
|
roomid: { from_secret: 'matrix_roomid' },
|
||||||
|
template: 'Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}<br/> Message: {{ commit.Message.Title }}',
|
||||||
|
username: { from_secret: 'matrix_username' },
|
||||||
|
password: { from_secret: 'matrix_password' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
depends_on: [
|
||||||
|
'documentation',
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
status: ['success', 'failure'],
|
||||||
|
ref: ['refs/heads/master', 'refs/tags/**'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
PipelineLinting,
|
||||||
|
PipelineDeployment(scenario='rocky8'),
|
||||||
|
PipelineDocumentation,
|
||||||
|
PipelineNotification,
|
||||||
|
]
|
152
.drone.yml
Normal file
152
.drone.yml
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: linting
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: ansible-later
|
||||||
|
image: thegeeklab/ansible-later
|
||||||
|
commands:
|
||||||
|
- ansible-later
|
||||||
|
|
||||||
|
- name: python-format
|
||||||
|
image: python:3.9
|
||||||
|
commands:
|
||||||
|
- pip install -qq yapf
|
||||||
|
- "[ -z \"$(find . -type f -name *.py)\" ] || (yapf -rd ./)"
|
||||||
|
environment:
|
||||||
|
PY_COLORS: 1
|
||||||
|
|
||||||
|
- name: python-flake8
|
||||||
|
image: python:3.9
|
||||||
|
commands:
|
||||||
|
- pip install -qq flake8
|
||||||
|
- flake8
|
||||||
|
environment:
|
||||||
|
PY_COLORS: 1
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: testing-rocky8
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
limit: 1
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
base: /drone/src
|
||||||
|
path: ${DRONE_REPO_NAME}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: ansible-molecule
|
||||||
|
image: thegeeklab/molecule:3
|
||||||
|
commands:
|
||||||
|
- molecule test -s rocky8
|
||||||
|
environment:
|
||||||
|
HCLOUD_TOKEN:
|
||||||
|
from_secret: hcloud_token
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- refs/tags/**
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linting
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: documentation
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: generate
|
||||||
|
image: thegeeklab/ansible-doctor
|
||||||
|
environment:
|
||||||
|
ANSIBLE_DOCTOR_EXCLUDE_FILES: molecule/
|
||||||
|
ANSIBLE_DOCTOR_FORCE_OVERWRITE: true
|
||||||
|
ANSIBLE_DOCTOR_LOG_LEVEL: INFO
|
||||||
|
ANSIBLE_DOCTOR_OUTPUT_DIR: _docs/
|
||||||
|
ANSIBLE_DOCTOR_ROLE_NAME: ${DRONE_REPO_NAME#*.}
|
||||||
|
ANSIBLE_DOCTOR_TEMPLATE: hugo-book
|
||||||
|
|
||||||
|
- name: publish
|
||||||
|
image: plugins/gh-pages
|
||||||
|
settings:
|
||||||
|
netrc_machine: gitea.rknet.org
|
||||||
|
pages_directory: _docs/
|
||||||
|
password:
|
||||||
|
from_secret: gitea_token
|
||||||
|
remote_url: https://gitea.rknet.org/ansible/${DRONE_REPO_NAME}
|
||||||
|
target_branch: docs
|
||||||
|
username:
|
||||||
|
from_secret: gitea_username
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- refs/tags/**
|
||||||
|
- refs/pull/**
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- testing-rocky8
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: notification
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: matrix
|
||||||
|
image: thegeeklab/drone-matrix
|
||||||
|
settings:
|
||||||
|
homeserver:
|
||||||
|
from_secret: matrix_homeserver
|
||||||
|
password:
|
||||||
|
from_secret: matrix_password
|
||||||
|
roomid:
|
||||||
|
from_secret: matrix_roomid
|
||||||
|
template: "Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}<br/> Message: {{ commit.Message.Title }}"
|
||||||
|
username:
|
||||||
|
from_secret: matrix_username
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- refs/tags/**
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- documentation
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: signature
|
||||||
|
hmac: dc7efcd1685dc6e2b7ea4c16316a8cb31df6bd0b95e425a2dd6c24419ba1259d
|
||||||
|
|
||||||
|
...
|
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# ---> Ansible
|
||||||
|
*.retry
|
||||||
|
plugins
|
||||||
|
library
|
||||||
|
|
||||||
|
# ---> Python
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# ---> Docs
|
||||||
|
/_docs
|
19
.later.yml
Normal file
19
.later.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
ansible:
|
||||||
|
custom_modules:
|
||||||
|
- iptables_raw
|
||||||
|
- openssl_pkcs12
|
||||||
|
- proxmox_kvm
|
||||||
|
- ucr
|
||||||
|
- corenetworks_dns
|
||||||
|
- corenetworks_token
|
||||||
|
|
||||||
|
rules:
|
||||||
|
exclude_files:
|
||||||
|
- molecule/
|
||||||
|
- "LICENSE*"
|
||||||
|
- "**/*.md"
|
||||||
|
- "**/*.ini"
|
||||||
|
|
||||||
|
exclude_filter:
|
||||||
|
- LINT0009
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
|
||||||
|
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 (including the next
|
||||||
|
paragraph) 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.
|
12
README.md
Normal file
12
README.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# xoxys.freshrss
|
||||||
|
|
||||||
|
[![Build Status](https://img.shields.io/drone/build/ansible/xoxys.freshrss?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/ansible/xoxys.freshrss)
|
||||||
|
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
|
||||||
|
|
||||||
|
Setup [FreshRSS](https://freshrss.org/) server. FreshRSS is a self-hosted RSS feed aggregator. It is lightweight, easy to work with, powerful, and customizable.
|
||||||
|
|
||||||
|
You can find the full documentation at [https://galaxy.geekdocs.de](https://galaxy.geekdocs.de/roles/cloud/freshrss/).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
108
defaults/main.yml
Normal file
108
defaults/main.yml
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
---
|
||||||
|
freshrss_version: latest
|
||||||
|
freshrss_image: "quay.io/thegeeklab/freshrss:{{ freshrss_version }}"
|
||||||
|
# @var freshrss_base_url:description: >
|
||||||
|
# Specify address of the freshrss instance, used when building absolute urls, e.g. for websub.
|
||||||
|
# @end
|
||||||
|
freshrss_base_url: "http://localhost/"
|
||||||
|
|
||||||
|
freshrss_user: "freshrss"
|
||||||
|
freshrss_user_home: "/home/{{ freshrss_user }}"
|
||||||
|
|
||||||
|
freshrss_container_name: freshrss
|
||||||
|
freshrss_restart_policy: always
|
||||||
|
freshrss_service_stopped: False
|
||||||
|
|
||||||
|
freshrss_service_name: freshrss
|
||||||
|
|
||||||
|
# @var freshrss_volumes:description: > Define required docker volumes.
|
||||||
|
# @end
|
||||||
|
# @var freshrss_volumes:example: >
|
||||||
|
# freshrss_volumes:
|
||||||
|
# - name: data
|
||||||
|
# # target location inside the container
|
||||||
|
# dest: /var/www/app/data
|
||||||
|
# type: volume
|
||||||
|
# @end
|
||||||
|
freshrss_volumes:
|
||||||
|
- name: freshrss_data
|
||||||
|
dest: /var/www/app/data
|
||||||
|
- name: freshrss_extensions
|
||||||
|
dest: /var/www/app/extensions
|
||||||
|
|
||||||
|
freshrss_exposed_ports:
|
||||||
|
- "127.0.0.1:8080:8080/tcp"
|
||||||
|
|
||||||
|
# @var freshrss_memory_limit: $ "_unset_"
|
||||||
|
# @var freshrss_memory_limit:example: $ "512m"
|
||||||
|
# @var freshrss_memory_reservation: $ "_unset_"
|
||||||
|
# @var freshrss_memory_reservation:example: $ "256m"
|
||||||
|
# @var freshrss_cpu_quota: $ "_unset_"
|
||||||
|
# @var freshrss_cpu_quota:example: $ "25000"
|
||||||
|
|
||||||
|
freshrss_cap_add: []
|
||||||
|
freshrss_cap_drop: []
|
||||||
|
freshrss_security_opt:
|
||||||
|
- no-new-privileges
|
||||||
|
|
||||||
|
freshrss_pids_limit: "-1"
|
||||||
|
|
||||||
|
freshrss_healthcheck:
|
||||||
|
test: '["CMD", "/usr/local/bin/healthcheck"]'
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
freshrss_default_user: "admin"
|
||||||
|
freshrss_default_password: "freshrss"
|
||||||
|
|
||||||
|
# @var freshrss_salt:description: >
|
||||||
|
# Salt is used to make crypto more unique. You can generate your own salt with
|
||||||
|
# e.g. `cat /proc/sys/kernel/random/uuid | sha1sum | awk '{print $1}'`.
|
||||||
|
# @end
|
||||||
|
# @var freshrss_salt: $ "_unset_"
|
||||||
|
|
||||||
|
freshrss_language: "en"
|
||||||
|
freshrss_title: "FreshRSS"
|
||||||
|
# @var freshrss_meta_description: $ "_unset_"
|
||||||
|
freshrss_allow_anonymous: False
|
||||||
|
freshrss_allow_anonymous_refresh: False
|
||||||
|
freshrss_auth_type: "form"
|
||||||
|
freshrss_api_enabled: False
|
||||||
|
freshrss_unsafe_autologin_enabled: False
|
||||||
|
freshrss_simplepie_syslog_enabled: True
|
||||||
|
freshrss_pubsubhubbub_enabled: False
|
||||||
|
freshrss_allow_robots: False
|
||||||
|
freshrss_allow_referrer: False
|
||||||
|
freshrss_limits_cookie_duration: "2592000"
|
||||||
|
freshrss_limits_cache_duration: "800"
|
||||||
|
freshrss_limits_timeout: "15"
|
||||||
|
freshrss_limits_max_inactivity: "10800"
|
||||||
|
freshrss_limits_max_feeds: "16384"
|
||||||
|
freshrss_limits_max_categories: "16384"
|
||||||
|
freshrss_limits_max_registrations: "1"
|
||||||
|
# @var freshrss_curlopt_ssl_verifyhost: $ "_unset_"
|
||||||
|
# @var freshrss_curlopt_ssl_verifypeer: $ "_unset_"
|
||||||
|
# @var freshrss_curlopt_proxytype: $ "_unset_"
|
||||||
|
# @var freshrss_curlopt_proxy: $ "_unset_"
|
||||||
|
# @var freshrss_curlopt_proxyport: $ "_unset_"
|
||||||
|
# @var freshrss_curlopt_proxyauth: $ "_unset_"
|
||||||
|
# @var freshrss_curlopt_proxyuserpwd: $ "_unset_"
|
||||||
|
|
||||||
|
# @var freshrss_extensions_enabled:description: >
|
||||||
|
# List of FreshRSS extensions to enable. Extensions must be already installed!
|
||||||
|
# @end
|
||||||
|
freshrss_extensions_enabled:
|
||||||
|
- "Tumblr-GDPR"
|
||||||
|
|
||||||
|
freshrss_db_type: sqlite
|
||||||
|
freshrss_db_server: localhost
|
||||||
|
freshrss_db_port: 5432
|
||||||
|
freshrss_db_name: freshrss
|
||||||
|
freshrss_db_user: freshrss
|
||||||
|
freshrss_db_password: secure
|
||||||
|
|
||||||
|
# @var freshrss_db_ssl_mode:description: This variable is only supported for `pgsql` DB type.
|
||||||
|
freshrss_db_ssl_mode: disable
|
||||||
|
# @var freshrss_db_ssl_mode:description: This variable is only supported for `pgsql` DB type.
|
||||||
|
freshrss_db_ssl_rootcert: /etc/ssl/certs/ca-certificates.crt
|
11
handlers/main.yml
Normal file
11
handlers/main.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- name: Restart service
|
||||||
|
systemd:
|
||||||
|
name: "{{ __freshrss_pod_name }}.service"
|
||||||
|
scope: user
|
||||||
|
state: restarted
|
||||||
|
daemon_reload: True
|
||||||
|
enabled: True
|
||||||
|
listen: __freshrss_restart
|
||||||
|
become: True
|
||||||
|
become_user: "{{ freshrss_user }}"
|
30
meta/main.yml
Normal file
30
meta/main.yml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Standards: 0.2
|
||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
# @meta author:value: [Robert Kaussow](https://gitea.rknet.org/xoxys)
|
||||||
|
author: Robert Kaussow <mail@thegeeklab.de>
|
||||||
|
namespace: xoxys
|
||||||
|
role_name: freshrss
|
||||||
|
# @meta description: >
|
||||||
|
# [![Source Code](https://img.shields.io/badge/gitea-source%20code-blue?logo=gitea&logoColor=white)](https://gitea.rknet.org/ansible/xoxys.freshrss)
|
||||||
|
# [![Build Status](https://img.shields.io/drone/build/ansible/xoxys.freshrss?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/ansible/xoxys.freshrss)
|
||||||
|
# [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/ansible/xoxys.freshrss/src/branch/master/LICENSE)
|
||||||
|
#
|
||||||
|
# Setup [FreshRSS](https://freshrss.org/) server. FreshRSS is a self-hosted RSS feed aggregator.
|
||||||
|
# It is lightweight, easy to work with, powerful, and customizable.
|
||||||
|
# @end
|
||||||
|
description: Setup FreshRSS server
|
||||||
|
license: MIT
|
||||||
|
min_ansible_version: 2.10
|
||||||
|
platforms:
|
||||||
|
- name: EL
|
||||||
|
versions:
|
||||||
|
- 7
|
||||||
|
galaxy_tags:
|
||||||
|
- rss
|
||||||
|
- news
|
||||||
|
- freshrss
|
||||||
|
dependencies: []
|
||||||
|
collections:
|
||||||
|
- xoxys.general
|
||||||
|
- community.general
|
1
molecule/default
Symbolic link
1
molecule/default
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
rocky8
|
3
molecule/pytest.ini
Normal file
3
molecule/pytest.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[pytest]
|
||||||
|
filterwarnings =
|
||||||
|
ignore::DeprecationWarning
|
11
molecule/requirements.yml
Normal file
11
molecule/requirements.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
collections:
|
||||||
|
- name: https://gitea.rknet.org/ansible/xoxys.general/releases/download/v2.1.1/xoxys-general-2.1.1.tar.gz
|
||||||
|
- name: community.general
|
||||||
|
- name: containers.podman
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- src: https://gitea.rknet.org/ansible/xoxys.podman
|
||||||
|
name: xoxys.podman
|
||||||
|
scm: git
|
||||||
|
version: master
|
7
molecule/rocky8/converge.yml
Normal file
7
molecule/rocky8/converge.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: xoxys.podman
|
||||||
|
- role: xoxys.freshrss
|
120
molecule/rocky8/create.yml
Normal file
120
molecule/rocky8/create.yml
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
---
|
||||||
|
- name: Create
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
gather_facts: false
|
||||||
|
no_log: "{{ molecule_no_log }}"
|
||||||
|
vars:
|
||||||
|
ssh_port: 22
|
||||||
|
ssh_user: root
|
||||||
|
ssh_path: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key"
|
||||||
|
tasks:
|
||||||
|
- name: Create SSH key
|
||||||
|
user:
|
||||||
|
name: "{{ lookup('env', 'USER') }}"
|
||||||
|
generate_ssh_key: true
|
||||||
|
ssh_key_file: "{{ ssh_path }}"
|
||||||
|
force: true
|
||||||
|
register: generated_ssh_key
|
||||||
|
|
||||||
|
- name: Register the SSH key name
|
||||||
|
set_fact:
|
||||||
|
ssh_key_name: "molecule-generated-{{ 12345 | random | to_uuid }}"
|
||||||
|
|
||||||
|
- name: Register SSH key for test instance(s)
|
||||||
|
hcloud_ssh_key:
|
||||||
|
name: "{{ ssh_key_name }}"
|
||||||
|
public_key: "{{ generated_ssh_key.ssh_public_key }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Create molecule instance(s)
|
||||||
|
hcloud_server:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
server_type: "{{ item.server_type }}"
|
||||||
|
ssh_keys:
|
||||||
|
- "{{ ssh_key_name }}"
|
||||||
|
image: "{{ item.image }}"
|
||||||
|
location: "{{ item.location | default(omit) }}"
|
||||||
|
datacenter: "{{ item.datacenter | default(omit) }}"
|
||||||
|
user_data: "{{ item.user_data | default(omit) }}"
|
||||||
|
api_token: "{{ lookup('env', 'HCLOUD_TOKEN') }}"
|
||||||
|
state: present
|
||||||
|
register: server
|
||||||
|
loop: "{{ molecule_yml.platforms }}"
|
||||||
|
async: 7200
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for instance(s) creation to complete
|
||||||
|
async_status:
|
||||||
|
jid: "{{ item.ansible_job_id }}"
|
||||||
|
register: hetzner_jobs
|
||||||
|
until: hetzner_jobs.finished
|
||||||
|
retries: 300
|
||||||
|
loop: "{{ server.results }}"
|
||||||
|
|
||||||
|
- name: Create volume(s)
|
||||||
|
hcloud_volume:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
server: "{{ item.name }}"
|
||||||
|
location: "{{ item.location | default(omit) }}"
|
||||||
|
size: "{{ item.volume_size | default(10) }}"
|
||||||
|
api_token: "{{ lookup('env', 'HCLOUD_TOKEN') }}"
|
||||||
|
state: "present"
|
||||||
|
loop: "{{ molecule_yml.platforms }}"
|
||||||
|
when: item.volume | default(False) | bool
|
||||||
|
register: volumes
|
||||||
|
async: 7200
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for volume(s) creation to complete
|
||||||
|
async_status:
|
||||||
|
jid: "{{ item.ansible_job_id }}"
|
||||||
|
register: hetzner_volumes
|
||||||
|
until: hetzner_volumes.finished
|
||||||
|
retries: 300
|
||||||
|
when: volumes.changed
|
||||||
|
loop: "{{ volumes.results }}"
|
||||||
|
|
||||||
|
# Mandatory configuration for Molecule to function.
|
||||||
|
|
||||||
|
- name: Populate instance config dict
|
||||||
|
set_fact:
|
||||||
|
instance_conf_dict:
|
||||||
|
{
|
||||||
|
"instance": "{{ item.hcloud_server.name }}",
|
||||||
|
"ssh_key_name": "{{ ssh_key_name }}",
|
||||||
|
"address": "{{ item.hcloud_server.ipv4_address }}",
|
||||||
|
"user": "{{ ssh_user }}",
|
||||||
|
"port": "{{ ssh_port }}",
|
||||||
|
"identity_file": "{{ ssh_path }}",
|
||||||
|
"volume": "{{ item.item.item.volume | default(False) | bool }}",
|
||||||
|
}
|
||||||
|
loop: "{{ hetzner_jobs.results }}"
|
||||||
|
register: instance_config_dict
|
||||||
|
when: server.changed | bool
|
||||||
|
|
||||||
|
- name: Convert instance config dict to a list
|
||||||
|
set_fact:
|
||||||
|
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
|
||||||
|
when: server.changed | bool
|
||||||
|
|
||||||
|
- name: Dump instance config
|
||||||
|
copy:
|
||||||
|
content: |
|
||||||
|
# Molecule managed
|
||||||
|
|
||||||
|
{{ instance_conf | to_nice_yaml(indent=2) }}
|
||||||
|
dest: "{{ molecule_instance_config }}"
|
||||||
|
when: server.changed | bool
|
||||||
|
|
||||||
|
- name: Wait for SSH
|
||||||
|
wait_for:
|
||||||
|
port: "{{ ssh_port }}"
|
||||||
|
host: "{{ item.address }}"
|
||||||
|
search_regex: SSH
|
||||||
|
delay: 10
|
||||||
|
loop: "{{ lookup('file', molecule_instance_config) | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Wait for VM to settle down
|
||||||
|
pause:
|
||||||
|
seconds: 30
|
78
molecule/rocky8/destroy.yml
Normal file
78
molecule/rocky8/destroy.yml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
- name: Destroy
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
gather_facts: false
|
||||||
|
no_log: "{{ molecule_no_log }}"
|
||||||
|
tasks:
|
||||||
|
- name: Check existing instance config file
|
||||||
|
stat:
|
||||||
|
path: "{{ molecule_instance_config }}"
|
||||||
|
register: cfg
|
||||||
|
|
||||||
|
- name: Populate the instance config
|
||||||
|
set_fact:
|
||||||
|
instance_conf: "{{ (lookup('file', molecule_instance_config) | from_yaml) if cfg.stat.exists else [] }}"
|
||||||
|
|
||||||
|
- name: Destroy molecule instance(s)
|
||||||
|
hcloud_server:
|
||||||
|
name: "{{ item.instance }}"
|
||||||
|
api_token: "{{ lookup('env', 'HCLOUD_TOKEN') }}"
|
||||||
|
state: absent
|
||||||
|
register: server
|
||||||
|
loop: "{{ instance_conf }}"
|
||||||
|
async: 7200
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for instance(s) deletion to complete
|
||||||
|
async_status:
|
||||||
|
jid: "{{ item.ansible_job_id }}"
|
||||||
|
register: hetzner_jobs
|
||||||
|
until: hetzner_jobs.finished
|
||||||
|
retries: 300
|
||||||
|
loop: "{{ server.results }}"
|
||||||
|
|
||||||
|
- pause:
|
||||||
|
seconds: 5
|
||||||
|
|
||||||
|
- name: Destroy volume(s)
|
||||||
|
hcloud_volume:
|
||||||
|
name: "{{ item.instance }}"
|
||||||
|
server: "{{ item.instance }}"
|
||||||
|
api_token: "{{ lookup('env', 'HCLOUD_TOKEN') }}"
|
||||||
|
state: "absent"
|
||||||
|
register: volumes
|
||||||
|
loop: "{{ instance_conf }}"
|
||||||
|
when: item.volume | default(False) | bool
|
||||||
|
async: 7200
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for volume(s) deletion to complete
|
||||||
|
async_status:
|
||||||
|
jid: "{{ item.ansible_job_id }}"
|
||||||
|
register: hetzner_volumes
|
||||||
|
until: hetzner_volumes.finished
|
||||||
|
retries: 300
|
||||||
|
when: volumes.changed
|
||||||
|
loop: "{{ volumes.results }}"
|
||||||
|
|
||||||
|
- name: Remove registered SSH key
|
||||||
|
hcloud_ssh_key:
|
||||||
|
name: "{{ instance_conf[0].ssh_key_name }}"
|
||||||
|
state: absent
|
||||||
|
when: (instance_conf | default([])) | length > 0
|
||||||
|
|
||||||
|
# Mandatory configuration for Molecule to function.
|
||||||
|
|
||||||
|
- name: Populate instance config
|
||||||
|
set_fact:
|
||||||
|
instance_conf: {}
|
||||||
|
|
||||||
|
- name: Dump instance config
|
||||||
|
copy:
|
||||||
|
content: |
|
||||||
|
# Molecule managed
|
||||||
|
|
||||||
|
{{ instance_conf | to_nice_yaml(indent=2) }}
|
||||||
|
dest: "{{ molecule_instance_config }}"
|
||||||
|
when: server.changed | bool
|
24
molecule/rocky8/molecule.yml
Normal file
24
molecule/rocky8/molecule.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
options:
|
||||||
|
role-file: molecule/requirements.yml
|
||||||
|
requirements-file: molecule/requirements.yml
|
||||||
|
env:
|
||||||
|
ANSIBLE_GALAXY_DISPLAY_PROGRESS: "false"
|
||||||
|
driver:
|
||||||
|
name: delegated
|
||||||
|
platforms:
|
||||||
|
- name: rocky8-freshrss
|
||||||
|
image: rocky-8
|
||||||
|
server_type: cx11
|
||||||
|
lint: |
|
||||||
|
/usr/local/bin/flake8
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
env:
|
||||||
|
ANSIBLE_FILTER_PLUGINS: ${ANSIBLE_FILTER_PLUGINS:-./plugins/filter}
|
||||||
|
ANSIBLE_LIBRARY: ${ANSIBLE_LIBRARY:-./library}
|
||||||
|
log: False
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
15
molecule/rocky8/prepare.yml
Normal file
15
molecule/rocky8/prepare.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
- name: Prepare
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: Bootstrap python for Ansible
|
||||||
|
raw: |
|
||||||
|
command -v python3 python || (
|
||||||
|
(test -e /usr/bin/dnf && sudo dnf install -y python3) ||
|
||||||
|
(test -e /usr/bin/apt && (apt -y update && apt install -y python-minimal)) ||
|
||||||
|
(test -e /usr/bin/yum && sudo yum -y -qq install python3) ||
|
||||||
|
echo "Warning: Python not boostrapped due to unknown platform."
|
||||||
|
)
|
||||||
|
become: true
|
||||||
|
changed_when: false
|
28
molecule/rocky8/tests/test_default.py
Normal file
28
molecule/rocky8/tests/test_default.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
import testinfra.utils.ansible_runner
|
||||||
|
|
||||||
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||||
|
os.environ["MOLECULE_INVENTORY_FILE"]
|
||||||
|
).get_hosts("all")
|
||||||
|
|
||||||
|
|
||||||
|
def test_freshrss_running(host):
|
||||||
|
container = host.run("sudo su - freshrss /bin/sh -c 'podman inspect freshrss'")
|
||||||
|
state = json.loads(container.stdout)
|
||||||
|
|
||||||
|
assert state[0]["State"]["Running"] is True
|
||||||
|
|
||||||
|
|
||||||
|
def test_freshrss_socket(host):
|
||||||
|
# Verify the socket is listening for HTTP traffic
|
||||||
|
assert host.socket("tcp://127.0.0.1:8080").is_listening
|
||||||
|
|
||||||
|
|
||||||
|
def test_freshrss_conn_error(host):
|
||||||
|
code = int(host.run("curl -s -w '%{http_code}' http://127.0.0.1:8080/ -o /dev/null").stdout)
|
||||||
|
body = host.run("curl -sX GET http://127.0.0.1:8080/").stdout
|
||||||
|
|
||||||
|
assert code == 200
|
||||||
|
assert "FreshRSS" in body
|
12
setup.cfg
Normal file
12
setup.cfg
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[flake8]
|
||||||
|
ignore = D100, D101, D102, D103, D105, D107, E402, W503
|
||||||
|
max-line-length = 99
|
||||||
|
inline-quotes = double
|
||||||
|
exclude = .git,.tox,__pycache__,build,dist,tests,*.pyc,*.egg-info,.cache,.eggs,env*
|
||||||
|
|
||||||
|
[yapf]
|
||||||
|
based_on_style = google
|
||||||
|
column_limit = 99
|
||||||
|
dedent_closing_brackets = true
|
||||||
|
coalesce_brackets = true
|
||||||
|
split_before_logical_operator = true
|
2
tasks/main.yml
Normal file
2
tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- include_tasks: setup.yml
|
81
tasks/setup.yml
Normal file
81
tasks/setup.yml
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
---
|
||||||
|
- block:
|
||||||
|
- name: Create systemd service user
|
||||||
|
user:
|
||||||
|
name: "{{ freshrss_user }}"
|
||||||
|
comment: "FreshRSS service user managed by Ansible"
|
||||||
|
create_home: True
|
||||||
|
home: "{{ freshrss_user_home }}"
|
||||||
|
password: "!"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Enable lingering for systemd user
|
||||||
|
command:
|
||||||
|
cmd: "loginctl enable-linger {{ freshrss_user }}"
|
||||||
|
creates: "/var/lib/systemd/linger/{{ freshrss_user }}"
|
||||||
|
|
||||||
|
- name: Create required directories
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ freshrss_user }}"
|
||||||
|
group: "{{ freshrss_user }}"
|
||||||
|
mode: 0700
|
||||||
|
loop:
|
||||||
|
- "{{ __freshrss_systemd_user_dir }}"
|
||||||
|
- "{{ __freshrss_systemd_env_dir }}"
|
||||||
|
|
||||||
|
- name: Deploy environment file
|
||||||
|
template:
|
||||||
|
src: systemd/environments/freshrss.env.j2
|
||||||
|
dest: "{{ __freshrss_systemd_env_dir }}/freshrss.env"
|
||||||
|
owner: "{{ freshrss_user }}"
|
||||||
|
group: "{{ freshrss_user }}"
|
||||||
|
mode: 0600
|
||||||
|
notify:
|
||||||
|
- __freshrss_restart
|
||||||
|
|
||||||
|
- name: Create systemd service files
|
||||||
|
template:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
owner: "{{ freshrss_user }}"
|
||||||
|
group: "{{ freshrss_user }}"
|
||||||
|
mode: "0644"
|
||||||
|
loop:
|
||||||
|
- src: systemd/user/freshrss-container.service.j2
|
||||||
|
dest: "{{ __freshrss_systemd_user_dir }}/{{ __freshrss_container_name }}.service"
|
||||||
|
- src: systemd/user/freshrss-pod.service.j2
|
||||||
|
dest: "{{ __freshrss_systemd_user_dir }}/{{ __freshrss_pod_name }}.service"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.dest }}"
|
||||||
|
notify:
|
||||||
|
- __freshrss_restart
|
||||||
|
become: True
|
||||||
|
become_user: root
|
||||||
|
|
||||||
|
- name: Create container volumes
|
||||||
|
containers.podman.podman_volume:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
state: "{{ item.state | default('present') }}"
|
||||||
|
loop: "{{ freshrss_volumes }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.name }}"
|
||||||
|
when: item.type | default("volume") | lower == "volume"
|
||||||
|
register: __freshrss_volumes_raw
|
||||||
|
become: True
|
||||||
|
become_user: "{{ freshrss_user }}"
|
||||||
|
|
||||||
|
- name: Register container volumes map
|
||||||
|
set_fact:
|
||||||
|
__freshrss_volumes_map: "{{ __freshrss_volumes_raw.results | json_query('[].volume') | items2dict(key_name='Name', value_name='Mountpoint') }}"
|
||||||
|
|
||||||
|
- name: Ensure service is up and running
|
||||||
|
systemd:
|
||||||
|
name: "{{ __freshrss_pod_name }}.service"
|
||||||
|
scope: user
|
||||||
|
state: started
|
||||||
|
daemon_reload: True
|
||||||
|
enabled: True
|
||||||
|
become: True
|
||||||
|
become_user: "{{ freshrss_user }}"
|
67
templates/systemd/environments/freshrss.env.j2
Normal file
67
templates/systemd/environments/freshrss.env.j2
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#jinja2:lstrip_blocks: True
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
FRESHRSS_ENVIRONMENT=production
|
||||||
|
{% if freshrss_salt is defined and freshrss_salt %}
|
||||||
|
FRESHRSS_SALT={{ freshrss_salt }}
|
||||||
|
{% endif %}
|
||||||
|
FRESHRSS_BASE_URL={{ freshrss_base_url }}
|
||||||
|
FRESHRSS_LANGUAGE={{ freshrss_language }}
|
||||||
|
FRESHRSS_TITLE={{ freshrss_title }}
|
||||||
|
{% if freshrss_meta_description is defined and freshrss_meta_description %}
|
||||||
|
FRESHRSS_META_DESCRIPTION={{ freshrss_meta_description }}
|
||||||
|
{% endif %}
|
||||||
|
FRESHRSS_DEFAULT_USER={{ freshrss_default_user }}
|
||||||
|
FRESHRSS_DEFAULT_PASSWORD={{ freshrss_default_password }}
|
||||||
|
FRESHRSS_ALLOW_ANONYMOUS={{ freshrss_allow_anonymous | bool | lower }}
|
||||||
|
FRESHRSS_ALLOW_ANONYMOUS_REFRESH={{ freshrss_allow_anonymous_refresh | bool | lower }}
|
||||||
|
FRESHRSS_AUTH_TYPE={{ freshrss_auth_type }}
|
||||||
|
FRESHRSS_API_ENABLED={{ freshrss_api_enabled | bool | lower }}
|
||||||
|
FRESHRSS_UNSAFE_AUTOLOGIN_ENABLED={{ freshrss_unsafe_autologin_enabled | bool | lower }}
|
||||||
|
FRESHRSS_SIMPLEPIE_SYSLOG_ENABLED={{ freshrss_simplepie_syslog_enabled | bool | lower }}
|
||||||
|
FRESHRSS_PUBSUBHUBBUB_ENABLED={{ freshrss_pubsubhubbub_enabled | bool | lower }}
|
||||||
|
FRESHRSS_ALLOW_ROBOTS={{ freshrss_allow_robots | bool | lower }}
|
||||||
|
FRESHRSS_ALLOW_REFERRER={{ freshrss_allow_referrer | bool | lower }}
|
||||||
|
FRESHRSS_LIMITS_COOKIE_DURATION={{ freshrss_limits_cookie_duration }}
|
||||||
|
FRESHRSS_LIMITS_CACHE_DURATION={{ freshrss_limits_cache_duration }}
|
||||||
|
FRESHRSS_LIMITS_TIMEOUT={{ freshrss_limits_timeout }}
|
||||||
|
FRESHRSS_LIMITS_MAX_INACTIVITY={{ freshrss_limits_max_inactivity }}
|
||||||
|
FRESHRSS_LIMITS_MAX_FEEDS={{ freshrss_limits_max_feeds }}
|
||||||
|
FRESHRSS_LIMITS_MAX_CATEGORIES={{ freshrss_limits_max_categories }}
|
||||||
|
FRESHRSS_LIMITS_MAX_REGISTRATIONS={{ freshrss_limits_max_registrations }}
|
||||||
|
{% if freshrss_curlopt_ssl_verifyhost is defined and freshrss_curlopt_ssl_verifyhost %}
|
||||||
|
FRESHRSS_CURLOPT_SSL_VERIFYHOST={{ freshrss_curlopt_ssl_verifyhost }}
|
||||||
|
{% endif %}
|
||||||
|
{% if freshrss_curlopt_ssl_verifypeer is defined and freshrss_curlopt_ssl_verifypeer %}
|
||||||
|
FRESHRSS_CURLOPT_SSL_VERIFYPEER={{ freshrss_curlopt_ssl_verifypeer }}
|
||||||
|
{% endif %}
|
||||||
|
{% if freshrss_curlopt_proxytype is defined and freshrss_curlopt_proxytype %}
|
||||||
|
FRESHRSS_CURLOPT_PROXYTYPE={{ freshrss_curlopt_proxytype }}
|
||||||
|
{% endif %}
|
||||||
|
{% if freshrss_curlopt_proxy is defined and freshrss_curlopt_proxy %}
|
||||||
|
FRESHRSS_CURLOPT_PROXY={{ freshrss_curlopt_proxy }}
|
||||||
|
{% endif %}
|
||||||
|
{% if freshrss_curlopt_proxyport is defined and freshrss_curlopt_proxyport %}
|
||||||
|
FRESHRSS_CURLOPT_PROXYPORT={{ freshrss_curlopt_proxyport }}
|
||||||
|
{% endif %}
|
||||||
|
{% if freshrss_curlopt_proxyauth is defined and freshrss_curlopt_proxyauth %}
|
||||||
|
FRESHRSS_CURLOPT_PROXYAUTH={{ freshrss_curlopt_proxyauth }}
|
||||||
|
{% endif %}
|
||||||
|
{% if freshrss_curlopt_proxyuserpwd is defined and freshrss_curlopt_proxyuserpwd %}
|
||||||
|
FRESHRSS_CURLOPT_PROXYUSERPWD={{ freshrss_curlopt_proxyuserpwd }}
|
||||||
|
{% endif %}
|
||||||
|
FRESHRSS_DB_TYPE={{ freshrss_db_type }}
|
||||||
|
{% if freshrss_db_type != "sqlite" %}
|
||||||
|
{% if freshrss_db_type == "pgsql" %}
|
||||||
|
FRESHRSS_DB_HOST={{ freshrss_db_server }};sslmode={{ freshrss_db_ssl_mode }}
|
||||||
|
FRESHRSS_POSTGRES_SSL_ROOTCERT={{ freshrss_db_ssl_rootcert }}
|
||||||
|
{% else %}
|
||||||
|
FRESHRSS_DB_HOST={{ freshrss_db_server }}
|
||||||
|
{% endif %}
|
||||||
|
FRESHRSS_DB_PORT={{ freshrss_db_port }}
|
||||||
|
FRESHRSS_DB_USER={{ freshrss_db_user }}
|
||||||
|
FRESHRSS_DB_PASSWORD={{ freshrss_db_password }}
|
||||||
|
FRESHRSS_DB_BASE={{ freshrss_db_name }}
|
||||||
|
FRESHRSS_DB_PREFIX=freshrss_
|
||||||
|
{% endif %}
|
||||||
|
FRESHRSS_EXTENSIONS_ENABLED={{ freshrss_extensions_enabled | join(',') }}
|
64
templates/systemd/user/freshrss-container.service.j2
Normal file
64
templates/systemd/user/freshrss-container.service.j2
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#jinja2:lstrip_blocks: True
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=FreshRSS App Server
|
||||||
|
Wants=network.target network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
Requires=dbus.socket
|
||||||
|
|
||||||
|
BindsTo={{ __freshrss_pod_name }}.service
|
||||||
|
After={{ __freshrss_pod_name }}.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=PODMAN_SYSTEMD_UNIT=%N
|
||||||
|
SyslogIdentifier=%N
|
||||||
|
LogExtraFields=CONTAINER_NAME=%N
|
||||||
|
Delegate=memory pids
|
||||||
|
|
||||||
|
Restart=always
|
||||||
|
RestartSec=15s
|
||||||
|
|
||||||
|
ExecStartPre=/usr/bin/podman rm --force --ignore {{ __freshrss_container_name }}
|
||||||
|
ExecStartPre=/usr/bin/podman pod exists {{ __freshrss_pod_name }}
|
||||||
|
ExecStartPre=/usr/bin/podman create \
|
||||||
|
--rm \
|
||||||
|
--restart=no \
|
||||||
|
--env-file={{ __freshrss_systemd_env_dir }}/freshrss.env \
|
||||||
|
--pod {{ __freshrss_pod_name }} \
|
||||||
|
{% if freshrss_memory_limit is defined %}
|
||||||
|
--memory={{ freshrss_memory_limit }} \
|
||||||
|
{% endif %}
|
||||||
|
{% if freshrss_memory_reservation is defined %}
|
||||||
|
-memory-reservation={{ freshrss_memory_reservation }} \
|
||||||
|
{% endif %}
|
||||||
|
{% if freshrss_cpu_quota is defined %}
|
||||||
|
--cpu-quota={{ freshrss_cpu_quota }} \
|
||||||
|
{% endif %}
|
||||||
|
--sdnotify=conmon \
|
||||||
|
{% for item in freshrss_security_opt %}
|
||||||
|
--security-opt={{ item }} \
|
||||||
|
{% endfor %}
|
||||||
|
{% for item in freshrss_cap_add %}
|
||||||
|
--cap-add={{ item }} \
|
||||||
|
{% endfor %}
|
||||||
|
{% for item in freshrss_cap_drop %}
|
||||||
|
--cap-drop={{ item }} \
|
||||||
|
{% endfor %}
|
||||||
|
--pids-limit={{ freshrss_pids_limit }} \
|
||||||
|
{% for volume in freshrss_volumes %}
|
||||||
|
--mount 'type={{ volume.type | default("volume") | lower }},src={{ volume.name }},target={{ volume.dest }}' \
|
||||||
|
{% endfor %}
|
||||||
|
--name={{ __freshrss_container_name }} \
|
||||||
|
{{ freshrss_image }}
|
||||||
|
|
||||||
|
ExecStart=/usr/bin/podman start {{ __freshrss_container_name }}
|
||||||
|
ExecStop=/usr/bin/podman stop --ignore -t 10 {{ __freshrss_container_name }}
|
||||||
|
ExecStopPost=/usr/bin/podman rm --force --ignore {{ __freshrss_container_name }}
|
||||||
|
|
||||||
|
Type=notify
|
||||||
|
NotifyAccess=all
|
||||||
|
KillMode=control-group
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target default.target
|
37
templates/systemd/user/freshrss-pod.service.j2
Normal file
37
templates/systemd/user/freshrss-pod.service.j2
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#jinja2:lstrip_blocks: True
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=FreshRSS Pod
|
||||||
|
Wants=network.target network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
Requires= dbus.socket {{ __freshrss_container_name }}.service
|
||||||
|
Before={{ __freshrss_container_name }}.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=PODMAN_SYSTEMD_UNIT=%N
|
||||||
|
SyslogIdentifier=%N
|
||||||
|
LogExtraFields=CONTAINER_NAME=%N
|
||||||
|
|
||||||
|
Delegate=memory pids
|
||||||
|
|
||||||
|
Restart=always
|
||||||
|
RestartSec=15s
|
||||||
|
|
||||||
|
ExecStartPre=/usr/bin/podman pod rm --force --ignore {{ __freshrss_pod_name }}
|
||||||
|
ExecStartPre=/usr/bin/podman pod create \
|
||||||
|
{% for port in freshrss_exposed_ports %}
|
||||||
|
--publish {{ port }} \
|
||||||
|
{% endfor %}
|
||||||
|
--share ipc,net,uts \
|
||||||
|
--name {{ __freshrss_pod_name }}
|
||||||
|
|
||||||
|
ExecStart=/usr/bin/podman pod start {{ __freshrss_pod_name }}
|
||||||
|
ExecStop=/usr/bin/podman pod stop --ignore -t 10 {{ __freshrss_pod_name }}
|
||||||
|
|
||||||
|
Type=forking
|
||||||
|
KillMode=control-group
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target default.target
|
6
vars/main.yml
Normal file
6
vars/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
__freshrss_systemd_user_dir: "{{ freshrss_user_home }}/.config/systemd/user"
|
||||||
|
__freshrss_systemd_env_dir: "{{ freshrss_user_home }}/.config/systemd/environments"
|
||||||
|
|
||||||
|
__freshrss_container_name: "{{ freshrss_service_name }}"
|
||||||
|
__freshrss_pod_name: "{{ freshrss_service_name }}-pod"
|
Loading…
Reference in New Issue
Block a user