103 lines
3.4 KiB
YAML
103 lines
3.4 KiB
YAML
---
|
|
- name: Create tandoor directory
|
|
ansible.builtin.file:
|
|
path: "{{ node['home_path'] }}/{{ item }}"
|
|
state: "directory"
|
|
owner: "{{ ansible_user }}"
|
|
group: "{{ node['group'] }}"
|
|
mode: "0770"
|
|
loop:
|
|
- "data/containers/tandoor"
|
|
- "data/containers/tandoor/mediafiles"
|
|
- "containers/tandoor"
|
|
- "containers/tandoor/ssl"
|
|
|
|
- name: Deploy root certificate
|
|
ansible.builtin.copy:
|
|
content: |
|
|
{{ hostvars['console']['ca']['root']['crt'] }}
|
|
dest: "{{ node['home_path'] }}/containers/tandoor/ssl/{{ root_cert_filename }}"
|
|
owner: "{{ ansible_user }}"
|
|
group: "{{ node['group'] }}"
|
|
mode: "0440"
|
|
notify: "notification_restart_tandoor"
|
|
no_log: true
|
|
|
|
- name: Register secret value to podman secret
|
|
containers.podman.podman_secret:
|
|
name: "{{ item.name }}"
|
|
data: "{{ item.value }}"
|
|
state: "present"
|
|
force: true
|
|
loop:
|
|
- name: "TANDOOR_SECRET_KEY"
|
|
value: "{{ hostvars['console']['tandoor']['secret_key'] }}"
|
|
- name: "TANDOOR_POSTGRES_PASSWORD"
|
|
value: "{{ hostvars['console']['postgresql']['password']['tandoor'] }}"
|
|
- name: "TANDOOR_SOCIALACCOUNT_PROVIDERS"
|
|
value: |
|
|
{
|
|
"openid_connect": {
|
|
"SCOPE": ["openid", "profile", "email"],
|
|
"OAUTH_PKCE_ENABLED": true,
|
|
"APPS": [
|
|
{
|
|
"provider_id": "authelia",
|
|
"name": "authelia",
|
|
"client_id": "tandoor",
|
|
"secret": "{{ hostvars['console']['tandoor']['oidc']['secret'] }}",
|
|
"settings": {
|
|
"server_url": "https://{{ services['authelia']['domain']['public'] }}.{{ domain['public'] }}/.well-known/openid-configuration",
|
|
"token_auth_method": "client_secret_basic"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
notify: "notification_restart_tandoor"
|
|
no_log: true
|
|
|
|
- name: Pull image
|
|
containers.podman.podman_image:
|
|
name: "docker.io/vabene1111/recipes"
|
|
tag: "{{ version['containers']['tandoor'] }}"
|
|
state: "present"
|
|
pull: true
|
|
|
|
- name: Deploy tandoor.container file
|
|
ansible.builtin.template:
|
|
src: "{{ hostvars['console']['node']['config_path'] }}/services/containers/app/tandoor/tandoor.container.j2"
|
|
dest: "{{ node['home_path'] }}/.config/containers/systemd/tandoor.container"
|
|
owner: "{{ ansible_user }}"
|
|
group: "{{ node['group'] }}"
|
|
mode: "0644"
|
|
notify: "notification_restart_tandoor"
|
|
|
|
- name: Enable tandoor.service
|
|
ansible.builtin.systemd:
|
|
name: "tandoor.service"
|
|
state: "started"
|
|
enabled: true
|
|
daemon_reload: true
|
|
scope: "user"
|
|
|
|
- name: Check container archive images
|
|
ansible.builtin.stat:
|
|
path: "{{ node['home_path'] }}/archives/containers/docker.io_vabene1111_recipes_{{ version['containers']['tandoor'] }}.tar"
|
|
register: container_archive_images
|
|
|
|
- name: Save container archive images
|
|
containers.podman.podman_save:
|
|
image:
|
|
- "docker.io/vabene1111/recipes:{{ version['containers']['tandoor'] }}"
|
|
dest: "{{ node['home_path'] }}/archives/containers/docker.io_vabene1111_recipes_{{ version['containers']['tandoor'] }}.tar"
|
|
format: "oci-archive"
|
|
force: false
|
|
when: not container_archive_images.stat.exists
|
|
|
|
- name: Fetch container archive images
|
|
ansible.builtin.fetch:
|
|
src: "{{ node['home_path'] }}/archives/containers/docker.io_vabene1111_recipes_{{ version['containers']['tandoor'] }}.tar"
|
|
dest: "{{ hostvars['console']['node']['data_path'] }}/images/containers/"
|
|
flat: true
|