Compare commits
42 Commits
transcaffe
...
main
Author | SHA1 | Date | |
---|---|---|---|
25be7155e0 | |||
950d017889 | |||
31639291f1 | |||
127a128a73 | |||
6bf38f8273 | |||
266057d11c | |||
afa91a622b | |||
d92262798a | |||
4b13c448d0 | |||
a9a988ec69 | |||
d9de07c8f8 | |||
c51dd4c142 | |||
bfd6449a71 | |||
7ebde915db | |||
a18c8c3355 | |||
5a6ffc6991 | |||
e7ea03c00e | |||
c7040c96f8 | |||
d8d0b5c9e5 | |||
1d1f519e3a | |||
11d5c81c60 | |||
f7eeb59288 | |||
72d8ac9644 | |||
d3d6f89949 | |||
43d0dc171a | |||
d8dfb24df0 | |||
57c8dae0c4 | |||
6385b6f7a8 | |||
7d09c9a88d | |||
98c60a73c6 | |||
5ac019bace | |||
43fd798712 | |||
88dc6377ce | |||
0a132b0ad5 | |||
72942ee382 | |||
755e5d55f2 | |||
5023a56b29 | |||
17dfe4b2bb | |||
cd122ebbdb | |||
0d914bd11c | |||
49ed240f10 | |||
81d6f809d7 |
11
README.md
11
README.md
@ -1,4 +1,4 @@
|
|||||||
# `finallycoffee.service` ansible collection
|
# `finallycoffee.services` ansible collection
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
@ -23,9 +23,18 @@ concise area of concern.
|
|||||||
- [`jellyfin`](roles/jellyfin/README.md): Deploy [jellyfin.org](https://jellyfin.org),
|
- [`jellyfin`](roles/jellyfin/README.md): Deploy [jellyfin.org](https://jellyfin.org),
|
||||||
the free software media system for streaming stored media to any device.
|
the free software media system for streaming stored media to any device.
|
||||||
|
|
||||||
|
- [`keycloak`](roles/keycloak/README.md): Deploy [keycloak](https://www.keycloak.org/),
|
||||||
|
the open source identity and access management solution.
|
||||||
|
|
||||||
- [`openproject`](roles/openproject/README.md): Deploys an [openproject.org](https://www.openproject.org)
|
- [`openproject`](roles/openproject/README.md): Deploys an [openproject.org](https://www.openproject.org)
|
||||||
installation using the upstream provided docker-compose setup.
|
installation using the upstream provided docker-compose setup.
|
||||||
|
|
||||||
|
- [`snipe_it`](roles/snipe_it/README.md): Deploys [Snipe-IT](https://snipeitapp.com/),
|
||||||
|
the free and open-source IT asset (and license) management with a powerful REST API
|
||||||
|
|
||||||
|
- [`vaultwarden`](roles/vaultwarden/README.md): Deploy [vaultwarden](https://github.com/dani-garcia/vaultwarden/),
|
||||||
|
an open-source implementation of the Bitwarden Server (formerly Bitwarden\_RS).
|
||||||
|
|
||||||
- [`vouch_proxy`](roles/vouch_proxy/README.md): Deploys [vouch-proxy](https://github.com/vouch/vouch-proxy),
|
- [`vouch_proxy`](roles/vouch_proxy/README.md): Deploys [vouch-proxy](https://github.com/vouch/vouch-proxy),
|
||||||
an authorization proxy for arbitrary webapps working with `nginx`s' `auth_request` module.
|
an authorization proxy for arbitrary webapps working with `nginx`s' `auth_request` module.
|
||||||
|
|
||||||
|
10
galaxy.yml
10
galaxy.yml
@ -1,6 +1,6 @@
|
|||||||
namespace: finallycoffee
|
namespace: finallycoffee
|
||||||
name: services
|
name: services
|
||||||
version: 0.1.3
|
version: 0.1.10
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- transcaffeine <transcaffeine@finally.coffee>
|
- transcaffeine <transcaffeine@finally.coffee>
|
||||||
@ -13,3 +13,11 @@ build_ignore:
|
|||||||
- '*.tar.gz'
|
- '*.tar.gz'
|
||||||
repository: https://git.finally.coffee/finallycoffee/services
|
repository: https://git.finally.coffee/finallycoffee/services
|
||||||
issues: https://codeberg.org/finallycoffee/ansible-collection-services/issues
|
issues: https://codeberg.org/finallycoffee/ansible-collection-services/issues
|
||||||
|
tags:
|
||||||
|
- authelia
|
||||||
|
- gitea
|
||||||
|
- hedgedoc
|
||||||
|
- jellyfin
|
||||||
|
- vaultwarden
|
||||||
|
- snipeit
|
||||||
|
- docker
|
||||||
|
6
playbooks/snipe_it.yml
Normal file
6
playbooks/snipe_it.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Install and configure Snipe-IT
|
||||||
|
hosts: "{{ snipe_it_hosts | default('snipe_it') }}"
|
||||||
|
become: "{{ snipe_it_become | default(true, false) }}"
|
||||||
|
roles:
|
||||||
|
- role: finallycoffee.services.snipe_it
|
6
playbooks/vaultwarden.yml
Normal file
6
playbooks/vaultwarden.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Install and configure vaultwarden
|
||||||
|
hosts: "{{ vaultwarden_hosts | default('vaultwarden') }}"
|
||||||
|
become: "{{ vaultwarden_become | default(true, false) }}"
|
||||||
|
roles:
|
||||||
|
- role: finallycoffee.services.vaultwarden
|
@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
authelia_version: "4.38.17"
|
||||||
authelia_version: 4.38.15
|
|
||||||
authelia_user: authelia
|
authelia_user: authelia
|
||||||
authelia_base_dir: /opt/authelia
|
authelia_base_dir: /opt/authelia
|
||||||
authelia_domain: authelia.example.org
|
authelia_domain: authelia.example.org
|
||||||
|
@ -4,5 +4,7 @@
|
|||||||
docker_container:
|
docker_container:
|
||||||
name: "{{ authelia_container_name }}"
|
name: "{{ authelia_container_name }}"
|
||||||
state: started
|
state: started
|
||||||
restart: yes
|
restart: true
|
||||||
|
comparisons:
|
||||||
|
'*': ignore
|
||||||
listen: restart-authelia
|
listen: restart-authelia
|
||||||
|
@ -170,7 +170,12 @@ authelia_config_access_control:
|
|||||||
default_policy: "{{ authelia_config_access_control_default_policy }}"
|
default_policy: "{{ authelia_config_access_control_default_policy }}"
|
||||||
networks: "{{ authelia_config_access_control_networks }}"
|
networks: "{{ authelia_config_access_control_networks }}"
|
||||||
rules: "{{ authelia_config_access_control_rules }}"
|
rules: "{{ authelia_config_access_control_rules }}"
|
||||||
authelia_config_session:
|
authelia_config_session: >-2
|
||||||
|
{{ authelia_config_session_base
|
||||||
|
| combine(({'redis': authelia_config_session_redis}
|
||||||
|
if authelia_config_session_redis_host else {}), recursive=true)
|
||||||
|
}}
|
||||||
|
authelia_config_session_base:
|
||||||
name: "{{ authelia_config_session_name }}"
|
name: "{{ authelia_config_session_name }}"
|
||||||
domain: "{{ authelia_config_session_domain }}"
|
domain: "{{ authelia_config_session_domain }}"
|
||||||
same_site: "{{ authelia_config_session_same_site }}"
|
same_site: "{{ authelia_config_session_same_site }}"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
ghost_domain: ~
|
ghost_domain: ~
|
||||||
ghost_version: "5.95.0"
|
ghost_version: "5.103.0"
|
||||||
ghost_user: ghost
|
ghost_user: ghost
|
||||||
ghost_user_group: ghost
|
ghost_user_group: ghost
|
||||||
ghost_base_path: /opt/ghost
|
ghost_base_path: /opt/ghost
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
gitea_version: "1.22.4"
|
||||||
gitea_version: "1.22.2"
|
|
||||||
gitea_user: git
|
gitea_user: git
|
||||||
gitea_run_user: "{{ gitea_user }}"
|
gitea_run_user: "{{ gitea_user }}"
|
||||||
gitea_base_path: "/opt/gitea"
|
gitea_base_path: "/opt/gitea"
|
||||||
@ -11,7 +10,7 @@ gitea_domain: ~
|
|||||||
|
|
||||||
# container config
|
# container config
|
||||||
gitea_container_name: "{{ gitea_user }}"
|
gitea_container_name: "{{ gitea_user }}"
|
||||||
gitea_contianer_image_server: "docker.io"
|
gitea_container_image_server: "docker.io"
|
||||||
gitea_container_image_name: "gitea"
|
gitea_container_image_name: "gitea"
|
||||||
gitea_container_image_namespace: gitea
|
gitea_container_image_namespace: gitea
|
||||||
gitea_container_image_fq_name: >-
|
gitea_container_image_fq_name: >-
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
# `finallycoffee.services.hedgedoc` ansible role
|
||||||
|
|
||||||
|
Role to deploy and configure hedgedoc using `docker` or `podman`.
|
||||||
|
To configure hedgedoc, set either the config as complex data
|
||||||
|
directly in `hedgedoc_config` or use the flattened variables
|
||||||
|
from the `hedgedoc_config_*` prefix (see
|
||||||
|
[defaults/main/config.yml](defaults/main/config.yml)).
|
||||||
|
|
||||||
|
To remove hedgedoc, set `hedgedoc_state: absent`. Note that this
|
||||||
|
will delete all data directories aswell, removing any traces this
|
||||||
|
role created on the target (except database contents).
|
||||||
|
|
||||||
|
# Required configuration
|
||||||
|
|
||||||
|
- `hedgedoc_config_domain` - Domain of the hedgedoc instance
|
||||||
|
- `hedgedoc_config_session_secret` - session secret for hedgedoc
|
||||||
|
|
||||||
|
## Deployment methods
|
||||||
|
|
||||||
|
To set the desired deployment method, set `hedgedoc_deployment_method` to a
|
||||||
|
supported deployment methods (see [vars/main.yml](vars/main.yml#5)).
|
@ -48,7 +48,10 @@ hedgedoc_container_all_volumes: >-2
|
|||||||
hedgedoc_container_base_labels:
|
hedgedoc_container_base_labels:
|
||||||
version: "{{ hedgedoc_container_tag | default(hedgedoc_version, true) }}"
|
version: "{{ hedgedoc_container_tag | default(hedgedoc_version, true) }}"
|
||||||
hedgedoc_container_labels: ~
|
hedgedoc_container_labels: ~
|
||||||
|
hedgedoc_container_network_mode: ~
|
||||||
hedgedoc_container_all_labels: >-2
|
hedgedoc_container_all_labels: >-2
|
||||||
{{ hedgedoc_container_base_labels | default({}, true)
|
{{ hedgedoc_container_base_labels | default({}, true)
|
||||||
| combine(hedgedoc_container_labels | default({}, true)) }}
|
| combine(hedgedoc_container_labels | default({}, true)) }}
|
||||||
hedgedoc_container_restart_policy: "unless-stopped"
|
hedgedoc_container_restart_policy: >-2
|
||||||
|
{{ (hedgedoc_deployment_method === 'docker')
|
||||||
|
| ternary('unless-stopped', 'on-failure') }}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
hedgedoc_user: hedgedoc
|
hedgedoc_user: hedgedoc
|
||||||
hedgedoc_version: 1.9.9
|
hedgedoc_version: "1.10.0"
|
||||||
|
|
||||||
hedgedoc_state: present
|
hedgedoc_state: present
|
||||||
hedgedoc_deployment_method: docker
|
hedgedoc_deployment_method: docker
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
hedgedoc_run_user_id: >-2
|
hedgedoc_run_user_id: >-2
|
||||||
{{ hedgedoc_user_info.uid | default(hedgedoc_user }}
|
{{ hedgedoc_user_info.uid | default(hedgedoc_user) }}
|
||||||
hedgedoc_run_group_id: >-2
|
hedgedoc_run_group_id: >-2
|
||||||
{{ hedgedoc_user_info.group | default(hedgedoc_user }}
|
{{ hedgedoc_user_info.group | default(hedgedoc_user) }}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
when: hedgedoc_deployment_method not in hedgedoc_deployment_methods
|
when: hedgedoc_deployment_method not in hedgedoc_deployment_methods
|
||||||
|
|
||||||
- name: Ensure required variables are given
|
- name: Ensure required variables are given
|
||||||
ansible.builtin.file:
|
ansible.builtin.fail:
|
||||||
msg: "Required variable '{{ item }}' is undefined!"
|
msg: "Required variable '{{ item }}' is undefined!"
|
||||||
loop: "{{ hedgedoc_required_arguments }}"
|
loop: "{{ hedgedoc_required_arguments }}"
|
||||||
when: >-2
|
when: >-2
|
||||||
|
@ -17,8 +17,15 @@
|
|||||||
name: "{{ hedgedoc_container_name }}"
|
name: "{{ hedgedoc_container_name }}"
|
||||||
image: "{{ hedgedoc_container_image }}"
|
image: "{{ hedgedoc_container_image }}"
|
||||||
env: "{{ hedgedoc_container_env | default(omit, true) }}"
|
env: "{{ hedgedoc_container_env | default(omit, true) }}"
|
||||||
|
user: "{{ hedgedoc_container_user | default(omit, true) }}"
|
||||||
|
ports: "{{ hedgedoc_container_ports | default(omit, true) }}"
|
||||||
labels: "{{ hedgedoc_container_all_labels }}"
|
labels: "{{ hedgedoc_container_all_labels }}"
|
||||||
volumes: "{{ hedgedoc_container_all_volumes }}"
|
volumes: "{{ hedgedoc_container_all_volumes }}"
|
||||||
etc_hosts: "{{ hedgedoc_container_etc_hosts | default(omit, true) }}"
|
etc_hosts: "{{ hedgedoc_container_etc_hosts | default(omit, true) }}"
|
||||||
restart_policy: "{{ hedgedoc_container_restart_policy | default(omit, true) }}"
|
dns_servers: >-2
|
||||||
|
{{ hedgedoc_container_dns_servers | default(omit, true) }}
|
||||||
|
network_mode: >-2
|
||||||
|
{{ hedgedoc_container_network_mode | default(omit, true) }}
|
||||||
|
restart_policy: >-2
|
||||||
|
{{ hedgedoc_container_restart_policy | default(omit, true) }}
|
||||||
state: "{{ hedgedoc_container_state }}"
|
state: "{{ hedgedoc_container_state }}"
|
||||||
|
@ -4,6 +4,7 @@ hedgedoc_states:
|
|||||||
- absent
|
- absent
|
||||||
hedgedoc_deployment_methods:
|
hedgedoc_deployment_methods:
|
||||||
- docker
|
- docker
|
||||||
|
- podman
|
||||||
|
|
||||||
hedgedoc_required_arguments:
|
hedgedoc_required_arguments:
|
||||||
- hedgedoc_config_domain
|
- hedgedoc_config_domain
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
jellyfin_user: jellyfin
|
jellyfin_user: jellyfin
|
||||||
jellyfin_version: 10.9.11
|
jellyfin_version: "10.10.3"
|
||||||
jellyfin_state: present
|
jellyfin_state: present
|
||||||
|
|
||||||
jellyfin_base_path: /opt/jellyfin
|
jellyfin_base_path: /opt/jellyfin
|
||||||
|
16
roles/keycloak/README.md
Normal file
16
roles/keycloak/README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# `finallycoffee.services.keycloak` ansible role
|
||||||
|
|
||||||
|
Ansible role for deploying keycloak, currently only supports docker.
|
||||||
|
|
||||||
|
Migrated from `entropia.sso.keycloak`.
|
||||||
|
|
||||||
|
## Required variables
|
||||||
|
|
||||||
|
- `keycloak_database_password` - password for the database user
|
||||||
|
- `keycloak_config_hostname` - public domain of the keycloak server
|
||||||
|
|
||||||
|
## Database configuration
|
||||||
|
|
||||||
|
- `keycloak_database_hostname` - hostname of the database server, defaults to `localhost`
|
||||||
|
- `keycloak_database_username` - username to use when connecting to the database server, defaults to `keycloak`
|
||||||
|
- `keycloak_database_database` - name of the database to use, defaults to `keycloak`
|
51
roles/keycloak/defaults/main.yml
Normal file
51
roles/keycloak/defaults/main.yml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
keycloak_version: 26.0.7
|
||||||
|
keycloak_container_name: keycloak
|
||||||
|
|
||||||
|
keycloak_container_image_upstream_registry: quay.io
|
||||||
|
keycloak_container_image_upstream_namespace: keycloak
|
||||||
|
keycloak_container_image_upstream_name: keycloak
|
||||||
|
keycloak_container_image_upstream: >-2
|
||||||
|
{{
|
||||||
|
([
|
||||||
|
keycloak_container_image_upstream_registry | default([]),
|
||||||
|
keycloak_container_image_upstream_namespace | default([]),
|
||||||
|
keycloak_container_image_upstream_name,
|
||||||
|
] | flatten | join('/'))
|
||||||
|
}}
|
||||||
|
keycloak_container_image_name: "keycloak:{{ keycloak_version }}-custom"
|
||||||
|
|
||||||
|
keycloak_container_database_vendor: postgres
|
||||||
|
keycloak_base_path: /opt/keycloak
|
||||||
|
keycloak_container_build_directory: "{{ keycloak_base_path }}/build"
|
||||||
|
keycloak_container_build_jar_directory: providers
|
||||||
|
keycloak_container_build_flags: {}
|
||||||
|
keycloak_provider_jars_directory: "{{ keycloak_base_path }}/providers"
|
||||||
|
keycloak_build_provider_jars_directory: "{{ keycloak_container_build_directory }}/{{ keycloak_container_build_jar_directory }}"
|
||||||
|
|
||||||
|
keycloak_database_hostname: localhost
|
||||||
|
keycloak_database_port: 5432
|
||||||
|
keycloak_database_username: keycloak
|
||||||
|
keycloak_database_password: ~
|
||||||
|
keycloak_database_database: keycloak
|
||||||
|
|
||||||
|
keycloak_container_env: {}
|
||||||
|
keycloak_container_labels: ~
|
||||||
|
keycloak_container_volumes: ~
|
||||||
|
keycloak_container_restart_policy: unless-stopped
|
||||||
|
keycloak_container_command: >-2
|
||||||
|
start
|
||||||
|
--db-username {{ keycloak_database_username }}
|
||||||
|
--db-password {{ keycloak_database_password }}
|
||||||
|
--db-url jdbc:postgresql://{{ keycloak_database_hostname }}{{ keycloak_database_port | ternary(':' ~ keycloak_database_port, '') }}/{{ keycloak_database_database }}
|
||||||
|
{{ keycloak_container_extra_start_flags | default([]) | join(' ') }}
|
||||||
|
--proxy-headers=xforwarded
|
||||||
|
--hostname {{ keycloak_config_hostname }}
|
||||||
|
--optimized
|
||||||
|
|
||||||
|
keycloak_config_health_enabled: true
|
||||||
|
keycloak_config_metrics_enabled: true
|
||||||
|
|
||||||
|
keycloak_config_hostname: localhost
|
||||||
|
keycloak_config_admin_username: admin
|
||||||
|
keycloak_config_admin_password: ~
|
13
roles/keycloak/meta/main.yml
Normal file
13
roles/keycloak/meta/main.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
allow_duplicates: true
|
||||||
|
dependencies: []
|
||||||
|
galaxy_info:
|
||||||
|
role_name: keycloak
|
||||||
|
description: Deploy keycloak, the opensource identity and access management solution
|
||||||
|
galaxy_tags:
|
||||||
|
- keycloak
|
||||||
|
- sso
|
||||||
|
- oidc
|
||||||
|
- oauth2
|
||||||
|
- iam
|
||||||
|
- docker
|
72
roles/keycloak/tasks/main.yml
Normal file
72
roles/keycloak/tasks/main.yml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure build directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
name: "{{ keycloak_container_build_directory }}"
|
||||||
|
state: directory
|
||||||
|
recurse: yes
|
||||||
|
mode: 0700
|
||||||
|
tags:
|
||||||
|
- keycloak-build-container
|
||||||
|
|
||||||
|
- name: Ensure provider jars directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
name: "{{ keycloak_provider_jars_directory }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0775
|
||||||
|
tags:
|
||||||
|
- keycloak-build-container
|
||||||
|
|
||||||
|
- name: Ensure Dockerfile is templated
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: Dockerfile.j2
|
||||||
|
dest: "{{ keycloak_container_build_directory }}/Dockerfile"
|
||||||
|
mode: 0700
|
||||||
|
register: keycloak_buildfile_info
|
||||||
|
tags:
|
||||||
|
- keycloak-container
|
||||||
|
- keycloak-build-container
|
||||||
|
|
||||||
|
- name: Ensure upstream Keycloak container image '{{ keycloak_container_image_upstream }}:{{ keycloak_version }}' is present
|
||||||
|
community.docker.docker_image:
|
||||||
|
name: "{{ keycloak_container_image_upstream }}:{{ keycloak_version }}"
|
||||||
|
source: pull
|
||||||
|
state: present
|
||||||
|
register: keycloak_container_image_upstream_status
|
||||||
|
tags:
|
||||||
|
- keycloak-container
|
||||||
|
- keycloak-build-container
|
||||||
|
|
||||||
|
- name: Ensure custom keycloak container image '{{ keycloak_container_image_name }}' is built
|
||||||
|
community.docker.docker_image:
|
||||||
|
name: "{{ keycloak_container_image_name }}"
|
||||||
|
build:
|
||||||
|
args:
|
||||||
|
DB_VENDOR: "{{ keycloak_container_database_vendor }}"
|
||||||
|
KC_ADMIN_PASSWORD: "{{ keycloak_config_admin_password }}"
|
||||||
|
dockerfile: "{{ keycloak_container_build_directory }}/Dockerfile"
|
||||||
|
path: "{{ keycloak_container_build_directory }}"
|
||||||
|
source: build
|
||||||
|
state: present
|
||||||
|
force_source: "{{ keycloak_buildfile_info.changed or keycloak_container_image_upstream_status.changed or (keycloak_force_rebuild_container | default(false))}}"
|
||||||
|
register: keycloak_container_image_status
|
||||||
|
tags:
|
||||||
|
- keycloak-container
|
||||||
|
- keycloak-build-container
|
||||||
|
|
||||||
|
- name: Ensure keycloak container is running
|
||||||
|
community.docker.docker_container:
|
||||||
|
name: "{{ keycloak_container_name }}"
|
||||||
|
image: "{{ keycloak_container_image_name }}"
|
||||||
|
env: "{{ keycloak_container_env | default(omit, true) }}"
|
||||||
|
ports: "{{ keycloak_container_ports | default(omit, true) }}"
|
||||||
|
hostname: "{{ keycloak_container_hostname | default(omit) }}"
|
||||||
|
labels: "{{ keycloak_container_labels | default(omit, true) }}"
|
||||||
|
volumes: "{{ keycloak_container_volumes | default(omit, true) }}"
|
||||||
|
restart_policy: "{{ keycloak_container_restart_policy }}"
|
||||||
|
recreate: "{{ keycloak_container_force_recreate | default(false) or (keycloak_container_image_status.changed if keycloak_container_image_status is defined else false) }}"
|
||||||
|
etc_hosts: "{{ keycloak_container_etc_hosts | default(omit) }}"
|
||||||
|
state: started
|
||||||
|
command: "{{ keycloak_container_command }}"
|
||||||
|
tags:
|
||||||
|
- keycloak-container
|
41
roles/keycloak/templates/Dockerfile.j2
Normal file
41
roles/keycloak/templates/Dockerfile.j2
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
FROM {{ keycloak_container_image_upstream }}:{{ keycloak_version }} as builder
|
||||||
|
|
||||||
|
# Enable health and metrics support
|
||||||
|
ENV KC_HEALTH_ENABLED={{ keycloak_config_health_enabled | ternary('true', 'false') }}
|
||||||
|
ENV KC_METRICS_ENABLED={{ keycloak_config_metrics_enabled | ternary('true', 'false') }}
|
||||||
|
|
||||||
|
# Configure a database vendor
|
||||||
|
ARG DB_VENDOR
|
||||||
|
ENV KC_DB=$DB_VENDOR
|
||||||
|
|
||||||
|
WORKDIR {{ keycloak_container_working_directory }}
|
||||||
|
|
||||||
|
ADD ./providers/* providers/
|
||||||
|
# Workaround to set correct mode on jar files
|
||||||
|
USER root
|
||||||
|
RUN chmod -R 0770 providers/*
|
||||||
|
USER keycloak
|
||||||
|
|
||||||
|
RUN {{ keycloak_container_working_directory }}/bin/kc.sh --verbose \
|
||||||
|
{% for argument in keycloak_container_build_flags | dict2items(key_name='flag', value_name='value') %}
|
||||||
|
--{{- argument['flag'] -}}{{- argument['value'] | default(false, true) | ternary('=' + argument['value'], '') }} \
|
||||||
|
{% endfor%}
|
||||||
|
build{% if keycloak_container_build_features | default([]) | length > 0 %} \
|
||||||
|
{% endif %}
|
||||||
|
{% if keycloak_container_build_features | default([]) | length > 0 %}
|
||||||
|
--features="{{ keycloak_container_build_features | join(',') }}"
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
FROM {{ keycloak_container_image_upstream }}:{{ keycloak_version }}
|
||||||
|
COPY --from=builder {{ keycloak_container_working_directory }}/ {{ keycloak_container_working_directory }}/
|
||||||
|
|
||||||
|
ENV KC_HOSTNAME={{ keycloak_config_hostname }}
|
||||||
|
ENV KEYCLOAK_ADMIN={{ keycloak_config_admin_username }}
|
||||||
|
ARG KC_ADMIN_PASSWORD
|
||||||
|
{% if keycloak_version | split('.') | first | int > 21 %}
|
||||||
|
ENV KEYCLOAK_ADMIN_PASSWORD=$KC_ADMIN_PASSWORD
|
||||||
|
{% else %}
|
||||||
|
ENV KEYCLOAK_PASSWORD=$KC_ADMIN_PASSWORD
|
||||||
|
{% endif %}
|
||||||
|
ENTRYPOINT ["{{ keycloak_container_working_directory }}/bin/kc.sh"]
|
3
roles/keycloak/vars/main.yml
Normal file
3
roles/keycloak/vars/main.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
keycloak_container_working_directory: /opt/keycloak
|
@ -2,9 +2,9 @@
|
|||||||
openproject_base_path: "/opt/openproject"
|
openproject_base_path: "/opt/openproject"
|
||||||
|
|
||||||
openproject_upstream_git_url: "https://github.com/opf/openproject-deploy.git"
|
openproject_upstream_git_url: "https://github.com/opf/openproject-deploy.git"
|
||||||
openproject_upstream_git_branch: "stable/13"
|
openproject_upstream_git_branch: "stable/14"
|
||||||
|
|
||||||
openproject_compose_project_path: "{{ openproject_base_path }}/compose"
|
openproject_compose_project_path: "{{ openproject_base_path }}"
|
||||||
openproject_compose_project_name: "openproject"
|
openproject_compose_project_name: "openproject"
|
||||||
openproject_compose_project_env_file: "{{ openproject_compose_project_path }}/.env"
|
openproject_compose_project_env_file: "{{ openproject_compose_project_path }}/.env"
|
||||||
openproject_compose_project_override_file: "{{ openproject_compose_project_path }}/docker-compose.override.yml"
|
openproject_compose_project_override_file: "{{ openproject_compose_project_path }}/docker-compose.override.yml"
|
||||||
|
@ -26,14 +26,13 @@
|
|||||||
content: "{{ openproject_compose_overrides | default({}) | to_nice_yaml }}"
|
content: "{{ openproject_compose_overrides | default({}) | to_nice_yaml }}"
|
||||||
|
|
||||||
- name: Ensure containers are pulled
|
- name: Ensure containers are pulled
|
||||||
community.docker.docker_compose:
|
community.docker.docker_compose_v2:
|
||||||
project_src: "{{ openproject_compose_project_path }}"
|
project_src: "{{ openproject_compose_project_path }}"
|
||||||
project_name: "{{ openproject_compose_project_name }}"
|
project_name: "{{ openproject_compose_project_name }}"
|
||||||
pull: true
|
pull: "missing"
|
||||||
|
|
||||||
- name: Ensure services are running
|
- name: Ensure services are running
|
||||||
community.docker.docker_compose:
|
community.docker.docker_compose_v2:
|
||||||
project_src: "{{ openproject_compose_project_path }}"
|
project_src: "{{ openproject_compose_project_path }}"
|
||||||
project_name: "{{ openproject_compose_project_name }}"
|
project_name: "{{ openproject_compose_project_name }}"
|
||||||
state: "present"
|
state: "present"
|
||||||
build: false
|
|
||||||
|
46
roles/snipe_it/README.md
Normal file
46
roles/snipe_it/README.md
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# `finallycoffee.services.snipe_it` ansible role
|
||||||
|
|
||||||
|
[Snipe-IT](https://snipeitapp.com/) is an open-source asset management with
|
||||||
|
a powerful JSON-REST API. This ansible role deploys and configures Snipe-IT.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Snipe-IT requires a MySQL-Database like MariaDB and a working email service
|
||||||
|
for sending email. For installing and configuring MariaDB, see
|
||||||
|
[`finallycoffee.base.mariadb`](https://galaxy.ansible.com/ui/repo/published/finallycoffee/base/content/role/mariadb/).
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Required variables to set are:
|
||||||
|
|
||||||
|
- `snipe_it_domain` - domain name of the snipe-it instance
|
||||||
|
- `snipe_it_config_app_url` - URL where snipe-it will be reachable including protocol and port
|
||||||
|
- `snipe_it_config_app_key` - Laravel application key
|
||||||
|
|
||||||
|
### Database configuration
|
||||||
|
|
||||||
|
All (database) options from the upstream laravel `.env` file are available
|
||||||
|
under the `snipe_it_config_db_*` prefix. Configure a database as follows:
|
||||||
|
```
|
||||||
|
snipe_it_config_db_host: localhost # defaults to localhost
|
||||||
|
snipe_it_config_db_port: "3306" # defaults to 3306
|
||||||
|
snipe_it_config_db_database: my_snipe_db_name # defaults to 'snipeit'
|
||||||
|
snipe_it_config_db_username: my_snipe_db_user # defaults to 'snipeit'
|
||||||
|
snipe_it_config_db_password: my_snipe_db_password
|
||||||
|
# Set this if the database is shared with
|
||||||
|
# other applications. defaults to not set
|
||||||
|
snipe_it_config_db_prefix: snipe_
|
||||||
|
```
|
||||||
|
|
||||||
|
### Email configuration
|
||||||
|
|
||||||
|
Configuring an email server is mandatory. An example is provided below:
|
||||||
|
```yaml
|
||||||
|
snipe_it_config_mail_host: smtp.example.com
|
||||||
|
snipe_it_config_mail_username: snipe_user@snipe.example.com
|
||||||
|
snipe_it_config_mail_password: i_want_to_be_strong_and_long
|
||||||
|
snipe_it_config_mail_from_addr: "noreply@snipe.example.com"
|
||||||
|
snipe_it_config_mail_from_name: "Example.com SnipeIT instance"
|
||||||
|
```
|
||||||
|
|
||||||
|
The default smtp port is `587` and can be set in `snipe_it_config_mail_port`.
|
131
roles/snipe_it/defaults/main/config.yml
Normal file
131
roles/snipe_it/defaults/main/config.yml
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
---
|
||||||
|
snipe_it_config_app_version: "v{{ snipe_it_version }}"
|
||||||
|
snipe_it_config_app_port: 8000
|
||||||
|
snipe_it_config_app_env: "production"
|
||||||
|
snipe_it_config_app_debug: false
|
||||||
|
snipe_it_config_app_key: ~
|
||||||
|
snipe_it_config_app_url: "http://localhost:{{ snipe_it_config_app_port }}"
|
||||||
|
snipe_it_config_app_timezone: UTC
|
||||||
|
snipe_it_config_app_locale: en-US
|
||||||
|
snipe_it_config_app_locked: false
|
||||||
|
snipe_it_config_app_cipher: "AES-256-GCM"
|
||||||
|
snipe_it_config_app_force_tls: false
|
||||||
|
snipe_it_config_app_trusted_proxies:
|
||||||
|
- '192.168.0.0/16'
|
||||||
|
- '172.16.0.0/12'
|
||||||
|
- '10.0.0.0/8'
|
||||||
|
|
||||||
|
snipe_it_config_db_connection: mysql
|
||||||
|
snipe_it_config_db_host: localhost
|
||||||
|
snipe_it_config_db_port: "3306"
|
||||||
|
snipe_it_config_db_database: snipeit
|
||||||
|
snipe_it_config_db_username: snipeit
|
||||||
|
snipe_it_config_db_password: ~
|
||||||
|
snipe_it_config_db_prefix: ~
|
||||||
|
snipe_it_config_db_dump_path: /usr/bin/
|
||||||
|
snipe_it_config_db_charset: utf8mb4
|
||||||
|
snipe_it_config_db_collation: utf8mb4_unicode_ci
|
||||||
|
snipe_it_config_db_ssl: false
|
||||||
|
snipe_it_config_db_ssl_is_paas: false
|
||||||
|
snipe_it_config_db_ssl_key_path: ~
|
||||||
|
snipe_it_config_db_ssl_cert_path: ~
|
||||||
|
snipe_it_config_db_ssl_ca_path: ~
|
||||||
|
snipe_it_config_db_ssl_cipher: ~
|
||||||
|
snipe_it_config_db_ssl_verify_server: ~
|
||||||
|
|
||||||
|
snipe_it_config_mail_mailer: smtp
|
||||||
|
snipe_it_config_mail_host: ~
|
||||||
|
snipe_it_config_mail_port: 587
|
||||||
|
snipe_it_config_mail_username: ~
|
||||||
|
snipe_it_config_mail_password: ~
|
||||||
|
snipe_it_config_mail_tls_verify_peer: true
|
||||||
|
snipe_it_config_mail_from_addr: ~
|
||||||
|
snipe_it_config_mail_from_name: ~
|
||||||
|
snipe_it_config_mail_replyto_addr: "{{ snipe_it_config_mail_from_addr }}"
|
||||||
|
snipe_it_config_mail_replyto_name: "{{ snipe_it_config_mail_from_name }}"
|
||||||
|
snipe_it_config_mail_auto_embed_method: attachment
|
||||||
|
snipe_it_config_mail_backup_notification_driver: ~
|
||||||
|
snipe_it_config_mail_backup_notification_address: ~
|
||||||
|
|
||||||
|
snipe_it_config_private_filesystem_disk: "local"
|
||||||
|
snipe_it_config_public_filesystem_disk: "local_public"
|
||||||
|
snipe_it_config_allow_backup_delete: false
|
||||||
|
snipe_it_config_allow_data_purge: false
|
||||||
|
snipe_it_config_image_lib: 'gd'
|
||||||
|
|
||||||
|
snipe_it_config_log_channel: 'stderr'
|
||||||
|
snipe_it_config_log_max_days: 10
|
||||||
|
|
||||||
|
snipe_it_config_cookie_name: "_snipe_session"
|
||||||
|
snipe_it_config_cookie_domain: "{{ snipe_it_domain }}"
|
||||||
|
snipe_it_config_secure_cookies: true
|
||||||
|
|
||||||
|
snipe_it_config_session_driver: file
|
||||||
|
snipe_it_config_session_lifetime: 12000
|
||||||
|
snipe_it_config_cache_driver: file
|
||||||
|
snipe_it_config_cache_prefix: snipeit
|
||||||
|
snipe_it_config_queue_driver: file
|
||||||
|
|
||||||
|
snipe_it_base_config:
|
||||||
|
APP_VERSION: "{{ snipe_it_config_app_version }}"
|
||||||
|
APP_PORT: "{{ snipe_it_config_app_port }}"
|
||||||
|
APP_ENV: "{{ snipe_it_config_app_env }}"
|
||||||
|
APP_DEBUG: "{{ snipe_it_config_app_debug }}"
|
||||||
|
APP_KEY: "{{ snipe_it_config_app_key }}"
|
||||||
|
APP_URL: "{{ snipe_it_config_app_url }}"
|
||||||
|
APP_TIMEZONE: "{{ snipe_it_config_app_timezone }}"
|
||||||
|
APP_LOCALE: "{{ snipe_it_config_app_locale }}"
|
||||||
|
APP_LOCKED: "{{ snipe_it_config_app_locked }}"
|
||||||
|
APP_CIPHER: "{{ snipe_it_config_app_cipher }}"
|
||||||
|
APP_FORCE_TLS: "{{ snipe_it_config_app_force_tls }}"
|
||||||
|
APP_TRUSTED_PROXIES: "{{ snipe_it_config_app_trusted_proxies | join(',') }}"
|
||||||
|
DB_CONNECTION: "{{ snipe_it_config_db_connection }}"
|
||||||
|
DB_HOST: "{{ snipe_it_config_db_host }}"
|
||||||
|
DB_PORT: "{{ snipe_it_config_db_port }}"
|
||||||
|
DB_DATABASE: "{{ snipe_it_config_db_database }}"
|
||||||
|
DB_USERNAME: "{{ snipe_it_config_db_username }}"
|
||||||
|
DB_PASSWORD: "{{ snipe_it_config_db_password }}"
|
||||||
|
DB_PREFIX: "{{ snipe_it_config_db_prefix | default('null', true) }}"
|
||||||
|
DB_DUMP_PATH: "{{ snipe_it_config_db_dump_path }}"
|
||||||
|
DB_CHARSET: "{{ snipe_it_config_db_charset }}"
|
||||||
|
DB_COLLATION: "{{ snipe_it_config_db_collation }}"
|
||||||
|
DB_SSL: "{{ snipe_it_config_db_ssl }}"
|
||||||
|
DB_SSL_IS_PAAS: "{{ snipe_it_config_db_ssl_is_paas }}"
|
||||||
|
DB_SSL_KEY_PATH: "{{ snipe_it_config_db_ssl_key_path | default('null', true) }}"
|
||||||
|
DB_SSL_CERT_PATH: "{{ snipe_it_config_db_ssl_cert_path | default('null', true) }}"
|
||||||
|
DB_SSL_CA_PATH: "{{ snipe_it_config_db_ssl_ca_path | default('null', true) }}"
|
||||||
|
DB_SSL_CIPHER: "{{ snipe_it_config_db_ssl_cipher | default('null', true) }}"
|
||||||
|
DB_SSL_VERIFY_SERVER: "{{ snipe_it_config_db_ssl_verify_server | default('null', true) }}"
|
||||||
|
MAIL_MAILER: "{{ snipe_it_config_mail_mailer }}"
|
||||||
|
MAIL_HOST: "{{ snipe_it_config_mail_host }}"
|
||||||
|
MAIL_PORT: "{{ snipe_it_config_mail_port }}"
|
||||||
|
MAIL_USERNAME: "{{ snipe_it_config_mail_username }}"
|
||||||
|
MAIL_PASSWORD: "{{ snipe_it_config_mail_password }}"
|
||||||
|
MAIL_TLS_VERIFY_PEER: "{{ snipe_it_config_mail_tls_verify_peer }}"
|
||||||
|
MAIL_FROM_ADDR: "{{ snipe_it_config_mail_from_addr | default('null', true) }}"
|
||||||
|
MAIL_FROM_NAME: "{{ snipe_it_config_mail_from_name | default('null', true) }}"
|
||||||
|
MAIL_REPLYTO_ADDR: "{{ snipe_it_config_mail_replyto_addr | default('null', true) }}"
|
||||||
|
MAIL_REPLYTO_NAME: "{{ snipe_it_config_mail_replyto_name | default('null', true) }}"
|
||||||
|
MAIL_AUTO_EMBED_METHOD: "{{ snipe_it_config_mail_auto_embed_method }}"
|
||||||
|
MAIL_BACKUP_NOTIFICATION_DRIVER: "{{ snipe_it_config_mail_backup_notification_driver }}"
|
||||||
|
MAIL_BACKUP_NOTIFICATION_ADDRESS: "{{ snipe_it_config_mail_backup_notification_address }}"
|
||||||
|
SESSION_DRIVER: "{{ snipe_it_config_session_driver }}"
|
||||||
|
SESSION_LIFETIME: "{{ snipe_it_config_session_lifetime }}"
|
||||||
|
CACHE_DRIVER: "{{ snipe_it_config_cache_driver }}"
|
||||||
|
CACHE_PREFIX: "{{ snipe_it_config_cache_prefix }}"
|
||||||
|
QUEUE_DRIVER: "{{ snipe_it_config_queue_driver }}"
|
||||||
|
PRIVATE_FILESYSTEM_DISK: "{{ snipe_it_config_private_filesystem_disk }}"
|
||||||
|
PUBLIC_FILESYSTEM_DISK: "{{ snipe_it_config_public_filesystem_disk }}"
|
||||||
|
ALLOW_BACKUP_DELETE: "{{ snipe_it_config_allow_backup_delete }}"
|
||||||
|
ALLOW_DATA_PURGE: "{{ snipe_it_config_allow_data_purge }}"
|
||||||
|
IMAGE_LIB: "{{ snipe_it_config_image_lib }}"
|
||||||
|
LOG_CHANNEL: "{{ snipe_it_config_log_channel }}"
|
||||||
|
LOG_MAX_DAYS: "{{ snipe_it_config_log_max_days }}"
|
||||||
|
COOKIE_NAME: "{{ snipe_it_config_cookie_name }}"
|
||||||
|
COOKIE_DOMAIN: "{{ snipe_it_config_cookie_domain }}"
|
||||||
|
SECURE_COOKIES: "{{ snipe_it_config_secure_cookies }}"
|
||||||
|
|
||||||
|
snipe_it_config: ~
|
||||||
|
snipe_it_merged_config: >-2
|
||||||
|
{{ (snipe_it_base_config | default({}, true))
|
||||||
|
| combine((snipe_it_config | default({}, true)), recursive=True) }}
|
48
roles/snipe_it/defaults/main/container.yml
Normal file
48
roles/snipe_it/defaults/main/container.yml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
snipe_it_container_image_registry: docker.io
|
||||||
|
snipe_it_container_image_namespace: snipe
|
||||||
|
snipe_it_container_image_name: 'snipe-it'
|
||||||
|
snipe_it_container_image_tag: ~
|
||||||
|
snipe_it_container_image_flavour: alpine
|
||||||
|
snipe_it_container_image_source: pull
|
||||||
|
snipe_it_container_image_force_source: >-2
|
||||||
|
{{ snipe_it_container_image_tag | default(false, true) | bool }}
|
||||||
|
snipe_it_container_image: >-2
|
||||||
|
{{
|
||||||
|
([
|
||||||
|
snipe_it_container_image_registry | default([], true),
|
||||||
|
snipe_it_container_image_namespace | default([], true),
|
||||||
|
snipe_it_container_image_name,
|
||||||
|
] | flatten | join('/'))
|
||||||
|
+ ':'
|
||||||
|
+ (snipe_it_container_image_tag | default(
|
||||||
|
'v' + snipe_it_version + (
|
||||||
|
((snipe_it_container_image_flavour is string)
|
||||||
|
and (snipe_it_container_image_flavour | length > 0))
|
||||||
|
| ternary(
|
||||||
|
'-' + snipe_it_container_image_flavour | default('', true),
|
||||||
|
''
|
||||||
|
)
|
||||||
|
),
|
||||||
|
true
|
||||||
|
))
|
||||||
|
}}
|
||||||
|
|
||||||
|
snipe_it_container_env_file: "/var/www/html/.env"
|
||||||
|
snipe_it_container_data_directory: "/var/lib/snipeit/"
|
||||||
|
snipe_it_container_volumes:
|
||||||
|
- "{{ snipe_it_data_directory }}:{{ snipe_it_container_data_directory }}:z"
|
||||||
|
|
||||||
|
snipe_it_container_name: 'snipe-it'
|
||||||
|
snipe_it_container_state: >-2
|
||||||
|
{{ (snipe_it_state == 'present') | ternary('started', 'absent') }}
|
||||||
|
snipe_it_container_env: ~
|
||||||
|
snipe_it_container_user: ~
|
||||||
|
snipe_it_container_ports: ~
|
||||||
|
snipe_it_container_labels: ~
|
||||||
|
snipe_it_container_recreate: ~
|
||||||
|
snipe_it_container_networks: ~
|
||||||
|
snipe_it_container_etc_hosts: ~
|
||||||
|
snipe_it_container_dns_servers: ~
|
||||||
|
snipe_it_container_network_mode: ~
|
||||||
|
snipe_it_container_restart_policy: 'unless-stopped'
|
9
roles/snipe_it/defaults/main/main.yml
Normal file
9
roles/snipe_it/defaults/main/main.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
snipe_it_user: snipeit
|
||||||
|
snipe_it_version: "7.1.15"
|
||||||
|
snipe_it_domain: ~
|
||||||
|
snipe_it_state: present
|
||||||
|
snipe_it_deployment_method: docker
|
||||||
|
|
||||||
|
snipe_it_env_file: /etc/snipeit/env
|
||||||
|
snipe_it_data_directory: /var/lib/snipeit
|
5
roles/snipe_it/defaults/main/user.yml
Normal file
5
roles/snipe_it/defaults/main/user.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
snipe_it_run_user_id: >-2
|
||||||
|
{{ snipe_it_user_info.uid | default(snipe_it_user) }}
|
||||||
|
snipe_it_run_group_id: >-2
|
||||||
|
{{ snipe_it_user_info.group | default(snipe_it_user) }}
|
12
roles/snipe_it/meta/main.yml
Normal file
12
roles/snipe_it/meta/main.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
allow_duplicates: true
|
||||||
|
dependencies: []
|
||||||
|
galaxy_info:
|
||||||
|
role_name: snipe_it
|
||||||
|
description: >-2
|
||||||
|
Deploy Snipe-IT, an open-source asset / license management system with
|
||||||
|
powerful JSON REST API
|
||||||
|
galaxy_tags:
|
||||||
|
- snipeit
|
||||||
|
- asset-management
|
||||||
|
- docker
|
14
roles/snipe_it/tasks/check.yml
Normal file
14
roles/snipe_it/tasks/check.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure state is valid
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: >-2
|
||||||
|
Unsupported state '{{ snipe_it_state }}'!
|
||||||
|
Supported states are {{ snipe_it_states | join(', ') }}.
|
||||||
|
when: snipe_it_state is not in snipe_it_states
|
||||||
|
|
||||||
|
- name: Ensure deployment method is valid
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: >-2
|
||||||
|
Unsupported deployment_method '{{ snipe_it_deployment_method }}'!
|
||||||
|
Supported values are {{ snipe_it_deployment_methods | join(', ') }}.
|
||||||
|
when: snipe_it_deployment_method is not in snipe_it_deployment_methods
|
30
roles/snipe_it/tasks/deploy-docker.yml
Normal file
30
roles/snipe_it/tasks/deploy-docker.yml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure container image '{{ snipe_it_container_image }}' is {{ snipe_it_state }}
|
||||||
|
community.docker.docker_image:
|
||||||
|
name: "{{ snipe_it_container_image }}"
|
||||||
|
state: "{{ snipe_it_state }}"
|
||||||
|
source: "{{ snipe_it_container_image_source }}"
|
||||||
|
force_source: "{{ snipe_it_container_image_force_source }}"
|
||||||
|
register: snipe_it_container_image_info
|
||||||
|
until: snipe_it_container_image_info is success
|
||||||
|
retries: 5
|
||||||
|
delay: 3
|
||||||
|
|
||||||
|
- name: Ensure container '{{ snipe_it_container_name }}' is {{ snipe_it_container_state }}
|
||||||
|
community.docker.docker_container:
|
||||||
|
name: "{{ snipe_it_container_name }}"
|
||||||
|
image: "{{ snipe_it_container_image }}"
|
||||||
|
env_file: "{{ snipe_it_env_file }}"
|
||||||
|
env: "{{ snipe_it_container_env | default(omit, true) }}"
|
||||||
|
user: "{{ snipe_it_container_user | default(omit, true) }}"
|
||||||
|
ports: "{{ snipe_it_container_ports | default(omit, true) }}"
|
||||||
|
labels: "{{ snipe_it_container_labels | default(omit, true) }}"
|
||||||
|
volumes: "{{ snipe_it_container_volumes | default(omit, true) }}"
|
||||||
|
networks: "{{ snipe_it_container_networks | default(omit, true) }}"
|
||||||
|
etc_hosts: "{{ snipe_it_container_etc_hosts | default(omit, true) }}"
|
||||||
|
dns_servers: "{{ snipe_it_container_dns_servers | default(omit, true) }}"
|
||||||
|
network_mode: "{{ snipe_it_container_network_mode | default(omit, true) }}"
|
||||||
|
restart_policy: >-2
|
||||||
|
{{ snipe_it_container_restart_policy | default(omit, true) }}
|
||||||
|
recreate: "{{ snipe_it_container_recreate | default(omit, true) }}"
|
||||||
|
state: "{{ snipe_it_container_state }}"
|
59
roles/snipe_it/tasks/main.yml
Normal file
59
roles/snipe_it/tasks/main.yml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
- name: Check preconditions
|
||||||
|
ansible.builtin.include_tasks:
|
||||||
|
file: "check.yml"
|
||||||
|
|
||||||
|
- name: Ensure snipe-it user '{{ snipe_it_user }}' is {{ snipe_it_state }}
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: "{{ snipe_it_user }}"
|
||||||
|
state: "{{ snipe_it_state }}"
|
||||||
|
system: "{{ snipe_it_user_system | default(true, true) }}"
|
||||||
|
create_home: "{{ snipe_it_user_create_home | default(false, true) }}"
|
||||||
|
groups: "{{ snipe_it_user_groups | default(omit, true) }}"
|
||||||
|
append: >-2
|
||||||
|
{{
|
||||||
|
snipe_it_user_groups_append | default(
|
||||||
|
snipe_it_user_groups | default([], true) | length > 0,
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
register: snipe_it_user_info
|
||||||
|
|
||||||
|
- name: Ensure snipe-it environment file is {{ snipe_it_state }}
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ snipe_it_env_file }}"
|
||||||
|
state: "{{ snipe_it_state }}"
|
||||||
|
when: snipe_it_state == 'absent'
|
||||||
|
|
||||||
|
- name: Ensure snipe-it config directory is {{ snipe_it_state }}
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ snipe_it_env_file | dirname }}"
|
||||||
|
state: "{{ (snipe_it_state == 'present') | ternary('directory', 'absent') }}"
|
||||||
|
owner: "{{ snipe_it_run_user_id }}"
|
||||||
|
group: "{{ snipe_it_run_group_id }}"
|
||||||
|
mode: "0755"
|
||||||
|
when: snipe_it_state == 'present'
|
||||||
|
|
||||||
|
- name: Ensure snipe-it data directory '{{ snipe_it_data_directory }}' is {{ snipe_it_state }}
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ snipe_it_data_directory }}"
|
||||||
|
state: "{{ (snipe_it_state == 'present') | ternary('directory', 'absent') }}"
|
||||||
|
owner: "{{ snipe_it_run_user_id }}"
|
||||||
|
group: "{{ snipe_it_run_group_id }}"
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Ensure snipe-it environment file is templated
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: |+2
|
||||||
|
{% for entry in snipe_it_merged_config | dict2items %}
|
||||||
|
{{ entry.key }}={{ entry.value }}
|
||||||
|
{% endfor %}
|
||||||
|
dest: "{{ snipe_it_env_file }}"
|
||||||
|
owner: "{{ snipe_it_run_user_id }}"
|
||||||
|
group: "{{ snipe_it_run_group_id }}"
|
||||||
|
mode: "0640"
|
||||||
|
when: snipe_it_state == 'present'
|
||||||
|
|
||||||
|
- name: Deploy using {{ snipe_it_deployment_method }}
|
||||||
|
ansible.builtin.include_tasks:
|
||||||
|
file: "deploy-{{ snipe_it_deployment_method }}.yml"
|
6
roles/snipe_it/vars/main.yml
Normal file
6
roles/snipe_it/vars/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
snipe_it_states:
|
||||||
|
- present
|
||||||
|
- absent
|
||||||
|
snipe_it_deployment_methods:
|
||||||
|
- docker
|
54
roles/vaultwarden/README.md
Normal file
54
roles/vaultwarden/README.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# `finallycoffee.services.vaultwarden` ansible role
|
||||||
|
|
||||||
|
Vaultwarden is an unofficial (not associated with Bitwarden) bitwarden API compatible
|
||||||
|
server backend, formally called `bitwarden_rs`, written in rust.
|
||||||
|
|
||||||
|
This ansible role can deploy and configure `vaultwarden`, and supports removing
|
||||||
|
itself using `vaultwarden_state: absent` (Warning: It does not ask for confirmation,
|
||||||
|
and will remove all user data when instructed to remove it).
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
To use this role, the following variables need to be populated:
|
||||||
|
|
||||||
|
- `vaultwarden_config_domain` - always. Changing this will lead to two-factor not working for two-factor methods registered in the past.
|
||||||
|
- `vaultwarden_config_admin_token` - if `vaultwarden_config_disable_admin_token` is `false`.
|
||||||
|
|
||||||
|
Setting other configuration values for vaultwarden can be done using role-provided flattened keys in the
|
||||||
|
`vaultwarden_config_*` namespace (see [`defaults/main/config.yml`](defaults/main/config.yml) for available variables),
|
||||||
|
or by setting the configuration directly in the same structure as the `config.json` would be in `vaultwarden_config`.
|
||||||
|
|
||||||
|
### Email
|
||||||
|
|
||||||
|
Configure mailing by first enabling SMTP using `vaultwarden_config_enable_smtp: true`,
|
||||||
|
then configure your email server like this:
|
||||||
|
```yaml
|
||||||
|
vaultwarden_config:
|
||||||
|
smtp_host: "mail.example.com"
|
||||||
|
smtp_explicit_tls: true
|
||||||
|
smtp_port: 465
|
||||||
|
smtp_from: "noreply+vaultwarden@example.com"
|
||||||
|
smtp_from_name: "'Example.com Vaultwarden instance' <noreply+vaultwarden@example.com>"
|
||||||
|
smtp_username: vaultwarden@example.com
|
||||||
|
smtp_password: i_hope_i_will_be_a_strong_one!
|
||||||
|
helo_name: "{{ vaultwarden_config_domain }}"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2FA via email
|
||||||
|
|
||||||
|
To enable email-based two-factor-authentication, set `vaultwarden_config_enable_email_2fa: true`
|
||||||
|
and optionally set the following configuration:
|
||||||
|
```yaml
|
||||||
|
vaultwarden_config:
|
||||||
|
email_token_size: 8
|
||||||
|
email_expiration_time: 300 # 300 seconds = 5min
|
||||||
|
email_attempts_limit: 3
|
||||||
|
```
|
||||||
|
|
||||||
|
### Feature flags
|
||||||
|
|
||||||
|
To enable more authentication methods, toggles are provided in
|
||||||
|
[`vaultwarden_config_enable_*`](defaults/main/config.yml#L18).
|
||||||
|
It is genereally recommended to simply keep unused methods off.
|
||||||
|
|
||||||
|
Per default, 'Sends' are allowed.
|
68
roles/vaultwarden/defaults/main/config.yml
Normal file
68
roles/vaultwarden/defaults/main/config.yml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
---
|
||||||
|
# Required configuration
|
||||||
|
vaultwarden_config_domain: ~
|
||||||
|
vaultwarden_config_admin_token: ~
|
||||||
|
# Invitations and signups
|
||||||
|
vaultwarden_config_invitations_allowed: false
|
||||||
|
vaultwarden_config_invitation_org_name: ~
|
||||||
|
vaultwarden_config_signups_allowed: false
|
||||||
|
vaultwarden_config_signups_verify: true
|
||||||
|
vaultwarden_config_signups_verify_resend_time: 3600
|
||||||
|
vaultwarden_config_signups_verify_resend_limit: 5
|
||||||
|
# Entry preview icons
|
||||||
|
vaultwarden_config_disable_icon_download: true
|
||||||
|
vaultwarden_config_icon_cache_ttl: 604800 # 7 days
|
||||||
|
vaultwarden_config_icon_cache_negttl: 259200 # 3 days
|
||||||
|
vaultwarden_config_icon_download_timeout: 30 # seconds
|
||||||
|
vaultwarden_config_icon_blacklist_non_global_ips: true
|
||||||
|
# Features
|
||||||
|
vaultwarden_config_sends_allowed: true
|
||||||
|
vaultwarden_config_enable_yubico: false
|
||||||
|
vaultwarden_config_enable_duo: false
|
||||||
|
vaultwarden_config_enable_smtp: false
|
||||||
|
vaultwarden_config_enable_email_2fa: false
|
||||||
|
# Security
|
||||||
|
vaultwarden_config_password_iterations: 100000
|
||||||
|
vaultwarden_config_show_password_hint: false
|
||||||
|
vaultwarden_config_disable_2fa_remember: false
|
||||||
|
vaultwarden_config_disable_admin_token: true
|
||||||
|
vaultwarden_config_require_device_email: false
|
||||||
|
vaultwarden_config_authenticator_disable_time_drift: true
|
||||||
|
# Other
|
||||||
|
vaultwarden_config_log_timestamp_format: "%Y-%m-%d %H:%M:%S.%3f"
|
||||||
|
vaultwarden_config_ip_header: "X-Real-IP"
|
||||||
|
vaultwarden_config_reload_templates: false
|
||||||
|
|
||||||
|
vaultwarden_base_config:
|
||||||
|
domain: "{{ vaultwarden_config_domain }}"
|
||||||
|
admin_token: "{{ vaultwarden_config_admin_token }}"
|
||||||
|
invitations_allowed: "{{ vaultwarden_config_invitations_allowed }}"
|
||||||
|
invitation_org_name: "{{ vaultwarden_config_invitation_org_name | default('', true) }}"
|
||||||
|
signups_allowed: "{{ vaultwarden_config_signups_allowed }}"
|
||||||
|
signups_verify: "{{ vaultwarden_config_signups_verify }}"
|
||||||
|
signups_verify_resend_time: "{{ vaultwarden_config_signups_verify_resend_time }}"
|
||||||
|
signups_verify_resend_limit: "{{ vaultwarden_config_signups_verify_resend_limit }}"
|
||||||
|
disable_icon_download: "{{ vaultwarden_config_disable_icon_download }}"
|
||||||
|
icon_cache_ttl: "{{ vaultwarden_config_icon_cache_ttl }}"
|
||||||
|
icon_cache_negttl: "{{ vaultwarden_config_icon_cache_negttl }}"
|
||||||
|
icon_download_timeout: "{{ vaultwarden_config_icon_download_timeout }}"
|
||||||
|
icon_blacklist_non_global_ips: "{{ vaultwarden_config_icon_blacklist_non_global_ips }}"
|
||||||
|
password_iterations: "{{ vaultwarden_config_password_iterations }}"
|
||||||
|
show_password_hint: "{{ vaultwarden_config_show_password_hint }}"
|
||||||
|
disable_2fa_remember: "{{ vaultwarden_config_disable_2fa_remember }}"
|
||||||
|
disable_admin_token: "{{ vaultwarden_config_disable_admin_token }}"
|
||||||
|
require_device_email: "{{ vaultwarden_config_require_device_email }}"
|
||||||
|
authenticator_disable_time_drift: "{{ vaultwarden_config_authenticator_disable_time_drift }}"
|
||||||
|
ip_header: "{{ vaultwarden_config_ip_header }}"
|
||||||
|
log_timestamp_format: "{{ vaultwarden_config_log_timestamp_format }}"
|
||||||
|
reload_templates: "{{ vaultwarden_config_reload_templates }}"
|
||||||
|
sends_allowed: "{{ vaultwarden_config_sends_allowed }}"
|
||||||
|
_enable_yubico: "{{ vaultwarden_config_enable_yubico }}"
|
||||||
|
_enable_duo: "{{ vaultwarden_config_enable_duo }}"
|
||||||
|
_enable_smtp: "{{ vaultwarden_config_enable_smtp }}"
|
||||||
|
_enable_email_2fa: "{{ vaultwarden_config_enable_email_2fa }}"
|
||||||
|
|
||||||
|
vaultwarden_config: ~
|
||||||
|
vaultwarden_merged_config: >-2
|
||||||
|
{{ vaultwarden_base_config | default({}, true)
|
||||||
|
| combine(vaultwarden_config | default({}, true), recursive=true) }}
|
50
roles/vaultwarden/defaults/main/container.yml
Normal file
50
roles/vaultwarden/defaults/main/container.yml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
vaultwarden_container_image_registry: docker.io
|
||||||
|
vaultwarden_container_image_namespace: vaultwarden
|
||||||
|
vaultwarden_container_image_name: server
|
||||||
|
vaultwarden_container_image_tag: ~
|
||||||
|
vaultwarden_container_image_flavour: alpine
|
||||||
|
vaultwarden_container_image_source: pull
|
||||||
|
vaultwarden_container_image_force_source: >-2
|
||||||
|
{{ vaultwarden_container_image_tag | default(false, true) | bool }}
|
||||||
|
vaultwarden_container_image: >-2
|
||||||
|
{{
|
||||||
|
([
|
||||||
|
vaultwarden_container_image_registry | default([], true),
|
||||||
|
vaultwarden_container_image_namespace | default([], true),
|
||||||
|
vaultwarden_container_image_name,
|
||||||
|
] | flatten | join('/'))
|
||||||
|
+ ':'
|
||||||
|
+ (vaultwarden_container_image_tag | default(
|
||||||
|
vaultwarden_version + (
|
||||||
|
((vaultwarden_container_image_flavour is string)
|
||||||
|
and (vaultwarden_container_image_flavour | length > 0))
|
||||||
|
| ternary(
|
||||||
|
'-' + vaultwarden_container_image_flavour | default('', true),
|
||||||
|
''
|
||||||
|
)
|
||||||
|
),
|
||||||
|
true
|
||||||
|
))
|
||||||
|
}}
|
||||||
|
|
||||||
|
vaultwarden_container_name: vaultwarden
|
||||||
|
vaultwarden_container_env: ~
|
||||||
|
vaultwarden_container_user: >-2
|
||||||
|
{{ vaultwarden_run_user_id }}:{{ vaultwarden_run_group_id }}
|
||||||
|
vaultwarden_container_ports: ~
|
||||||
|
vaultwarden_container_labels: ~
|
||||||
|
vaultwarden_container_networks: ~
|
||||||
|
vaultwarden_container_etc_hosts: ~
|
||||||
|
vaultwarden_container_dns_servers: ~
|
||||||
|
vaultwarden_container_restart_policy: >-2
|
||||||
|
{{ (vaultwarden_deployment_method == 'docker') | ternary(
|
||||||
|
'unless-stopped',
|
||||||
|
'on-failure',
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
vaultwarden_container_state: >-2
|
||||||
|
{{ (vaultwarden_state == 'present') | ternary('started', 'absent') }}
|
||||||
|
vaultwarden_container_volumes:
|
||||||
|
- "{{ vaultwarden_data_directory }}:/data:rw"
|
||||||
|
- "{{ vaultwarden_config_file }}:/data/config.json:ro"
|
10
roles/vaultwarden/defaults/main/main.yml
Normal file
10
roles/vaultwarden/defaults/main/main.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
vaultwarden_user: vaultwarden
|
||||||
|
vaultwarden_version: "1.32.7"
|
||||||
|
|
||||||
|
vaultwarden_config_file: "/etc/vaultwarden/config.json"
|
||||||
|
vaultwarden_config_directory: "{{ vaultwarden_config_file | dirname }}"
|
||||||
|
vaultwarden_data_directory: "/var/lib/vaultwarden"
|
||||||
|
|
||||||
|
vaultwarden_state: present
|
||||||
|
vaultwarden_deployment_method: docker
|
5
roles/vaultwarden/defaults/main/user.yml
Normal file
5
roles/vaultwarden/defaults/main/user.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
vaultwarden_run_user_id: >-2
|
||||||
|
{{ vaultwarden_user_info.uid | default(vaultwarden_user, true) }}
|
||||||
|
vaultwarden_run_group_id: >-2
|
||||||
|
{{ vaultwarden_user_info.group | default(vaultwarden_user, true) }}
|
9
roles/vaultwarden/handlers/main.yml
Normal file
9
roles/vaultwarden/handlers/main.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure vaultwarden container '{{ vaultwarden_container_name }}' is restarted
|
||||||
|
community.docker.docker_container:
|
||||||
|
name: "{{ vaultwarden_container_name }}"
|
||||||
|
state: "{{ vaultwarden_container_state }}"
|
||||||
|
restart: true
|
||||||
|
listen: vaultwarden-restart
|
||||||
|
when: vaultwarden_deployment_method == 'docker'
|
||||||
|
ignore_errors: "{{ ansible_check_mode }}"
|
12
roles/vaultwarden/meta/main.yml
Normal file
12
roles/vaultwarden/meta/main.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
allow_duplicates: true
|
||||||
|
dependencies: []
|
||||||
|
galaxy_info:
|
||||||
|
role_name: vaultwarden
|
||||||
|
description: >-2
|
||||||
|
Deploy vaultwarden, a bitwarden-compatible server backend
|
||||||
|
galaxy_tags:
|
||||||
|
- vaultwarden
|
||||||
|
- bitwarden
|
||||||
|
- passwordstore
|
||||||
|
- docker
|
22
roles/vaultwarden/tasks/deploy-docker.yml
Normal file
22
roles/vaultwarden/tasks/deploy-docker.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure container image '{{ vaultwarden_container_image }}' is {{ vaultwarden_state }}
|
||||||
|
community.docker.docker_image:
|
||||||
|
name: "{{ vaultwarden_container_image }}"
|
||||||
|
state: "{{ vaultwarden_state }}"
|
||||||
|
source: "{{ vaultwarden_container_image_source }}"
|
||||||
|
force_source: "{{ vaultwarden_container_image_force_source }}"
|
||||||
|
|
||||||
|
- name: Ensure container '{{ vaultwarden_container_name }}' is {{ vaultwarden_container_state }}
|
||||||
|
community.docker.docker_container:
|
||||||
|
name: "{{ vaultwarden_container_name }}"
|
||||||
|
image: "{{ vaultwarden_container_image }}"
|
||||||
|
env: "{{ vaultwarden_container_env | default(omit, true) }}"
|
||||||
|
user: "{{ vaultwarden_container_user | default(omit, true) }}"
|
||||||
|
ports: "{{ vaultwarden_container_ports | default(omit, true) }}"
|
||||||
|
labels: "{{ vaultwarden_container_labels | default(omit, true) }}"
|
||||||
|
volumes: "{{ vaultwarden_container_volumes }}"
|
||||||
|
networks: "{{ vaultwarden_container_networks | default(omit, true) }}"
|
||||||
|
etc_hosts: "{{ vaultwarden_container_etc_hosts | default(omit, true) }}"
|
||||||
|
dns_servers: "{{ vaultwarden_container_dns_servers | default(omit, true) }}"
|
||||||
|
restart_policy: "{{ vaultwarden_container_restart_policy | default(omit, true) }}"
|
||||||
|
state: "{{ vaultwarden_container_state | default(omit, true) }}"
|
78
roles/vaultwarden/tasks/main.yml
Normal file
78
roles/vaultwarden/tasks/main.yml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure state is valid
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: >-2
|
||||||
|
Unsupported state '{{ vaultwarden_state }}'!
|
||||||
|
Supported states are {{ vaultwarden_states | join(', ') }}.
|
||||||
|
when: vaultwarden_state not in vaultwarden_states
|
||||||
|
|
||||||
|
- name: Ensure deployment method is valid
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: >-2
|
||||||
|
Unsupported deployment method '{{ vaultwarden_deployment_method }}'!
|
||||||
|
Supported are {{ vaultwarden_deployment_methods | join(', ') }}.
|
||||||
|
when: vaultwarden_deployment_method not in vaultwarden_deployment_methods
|
||||||
|
|
||||||
|
- name: Ensure required variables are given
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: "Required variable '{{ var }}' is undefined!"
|
||||||
|
loop: "{{ vaultwarden_required_variables }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: var
|
||||||
|
when: >-2
|
||||||
|
var not in hostvars[inventory_hostname]
|
||||||
|
or hostvars[inventory_hostname][var] | length == 0
|
||||||
|
|
||||||
|
- name: Ensure required variables are given
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: "Required variable '{{ var.name }}' is undefined!"
|
||||||
|
loop: "{{ vaultwarden_conditionally_required_variables }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: var
|
||||||
|
label: "{{ var.name }}"
|
||||||
|
when: >-2
|
||||||
|
var.when and (
|
||||||
|
var.name not in hostvars[inventory_hostname]
|
||||||
|
or hostvars[inventory_hostname][var.name] | length == 0)
|
||||||
|
|
||||||
|
- name: Ensure vaultwarden user '{{ vaultwarden_user }}' is {{ vaultwarden_state }}
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: "{{ vaultwarden_user }}"
|
||||||
|
state: "{{ vaultwarden_state }}"
|
||||||
|
system: "{{ vaultwarden_user_system | default(true, true) }}"
|
||||||
|
create_home: "{{ vaultwarden_user_create_home | default(false, true) }}"
|
||||||
|
groups: "{{ vaultwarden_user_groups | default(omit, true) }}"
|
||||||
|
append: >-2
|
||||||
|
{{ vaultwarden_user_append_groups | default(
|
||||||
|
(vaultwarden_user_groups | default([], true) | length > 0),
|
||||||
|
true,
|
||||||
|
) }}
|
||||||
|
register: vaultwarden_user_info
|
||||||
|
|
||||||
|
- name: Ensure base paths are {{ vaultwarden_state }}
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ mount.path }}"
|
||||||
|
state: "{{ (vaultwarden_state == 'present') | ternary('directory', 'absent') }}"
|
||||||
|
owner: "{{ mount.owner | default(vaultwarden_run_user_id) }}"
|
||||||
|
group: "{{ mount.group | default(vaultwarden_run_group_id) }}"
|
||||||
|
mode: "{{ mount.mode | default('0755', true) }}"
|
||||||
|
loop:
|
||||||
|
- path: "{{ vaultwarden_config_directory }}"
|
||||||
|
- path: "{{ vaultwarden_data_directory }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: mount
|
||||||
|
label: "{{ mount.path }}"
|
||||||
|
|
||||||
|
- name: Ensure vaultwarden config file '{{ vaultwarden_config_file }}' is {{ vaultwarden_state }}
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ vaultwarden_merged_config | to_nice_json(indent=4) }}"
|
||||||
|
dest: "{{ vaultwarden_config_file }}"
|
||||||
|
owner: "{{ vaultwarden_run_user_id }}"
|
||||||
|
group: "{{ vaultwarden_run_group_id }}"
|
||||||
|
mode: "0640"
|
||||||
|
when: vaultwarden_state == 'present'
|
||||||
|
notify: vaultwarden-restart
|
||||||
|
|
||||||
|
- name: Deploy vaultwarden using {{ vaultwarden_deployment_method }}
|
||||||
|
ansible.builtin.include_tasks:
|
||||||
|
file: "deploy-{{ vaultwarden_deployment_method }}.yml"
|
11
roles/vaultwarden/vars/main.yml
Normal file
11
roles/vaultwarden/vars/main.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
vaultwarden_states:
|
||||||
|
- present
|
||||||
|
- absent
|
||||||
|
vaultwarden_deployment_methods:
|
||||||
|
- docker
|
||||||
|
vaultwarden_required_variables:
|
||||||
|
- vaultwarden_config_domain
|
||||||
|
vaultwarden_conditionally_required_variables:
|
||||||
|
- name: vaultwarden_config_admin_token
|
||||||
|
when: "{{ vaultwarden_config_disable_admin_token | default(true, true) | bool }}"
|
Loading…
Reference in New Issue
Block a user