---
- include_tasks: utils/once/flag.yml
- name: "๐งญ Remember the public view of this deploy for the CLI probe"
ansible.builtin.set_fact:
openpost_public_view:
proxy_address: "{{ hostvars[STACK_HOST].ansible_facts.default_ipv4.address if IS_SWARM_MODE else '' }}"
public_url: "{{ OPENPOST_URL }}"
api_headers: "{{ OPENPOST_API_HEADERS }}"
s3_public_url: "{{ lookup('objstore', application_id, 'public_url') | regex_replace('/?$', '/') if OPENPOST_OBJSTORE_ENABLED | bool else '' }}"
smtp_enabled: "{{ OPENPOST_SMTP_ENABLED | bool }}"
relay_targets: >-
{%- set _targets = {} -%}
{%- for _key, _role in OPENPOST_RELAY_SIBLINGS.items() if lookup('config', application_id, 'services.' ~ _key ~ '.enabled') | bool -%}
{%- set _ = _targets.update({_key: lookup('domain', _role)}) -%}
{%- endfor -%}
{{ _targets }}
routes: >-
{%- set _routes = [] -%}
{%- for _route in OPENPOST_CROSSPOSTER_ROUTES -%}
{%- set _ = _routes.append({'name': _route.name, 'platform': _route.source.platform, 'base_url': _route.source.base_url, 'account': _route.source.account, 'mode': _route.mode, 'tags': _route.filters.tags, 'social_set': _route.targets.social_set | default('', true)}) -%}
{%- endfor -%}
{{ _routes }}
- name: "๐ Pin OpenPost apps on the sibling Mastodon and Pixelfed instances"
include_tasks: 01_fediverse_apps.yml
- name: "๐งช Prepare the provider simulator"
include_tasks:
file: 02_simulator.yml
apply:
delegate_to: "{{ STACK_HOST }}"
run_once: true
when: OPENPOST_SIMULATOR_ENABLED | bool
- name: "๐งฉ load docker, db and proxy for {{ application_id }}"
include_role:
name: sys-stk-full
vars:
compose_handlers_flush: false
webserver_extra_configuration: >-
{{ lookup('template', 'nginx/echo_routes.conf.j2')
~ (lookup('file', lookup('path_absolute', 'roles/web-app-openpost/files/nginx/deny-password-registration.conf'))
if OPENPOST_OIDC_ENABLED | bool else '') }}
- name: "๐ Render the egress relay config (local + swarm peers)"
ansible.builtin.include_tasks:
file: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/render_replicated_templates.yml') }}"
vars:
role_templates:
- src: "relay.conf.j2"
dest: "{{ OPENPOST_RELAY_CONF_HOST }}"
mode: "0644"
- name: "๐ฎ Stage and render the crossposter"
include_tasks: crossposter/render.yml
when: OPENPOST_CROSSPOSTER_ENABLED | bool
- name: "๐ญ Stage and render the fake provider"
include_tasks: provider/render.yml
when: OPENPOST_PROVIDER_ENABLED | bool
- name: "๐ฟ flush handlers for '{{ application_id }}'"
meta: flush_handlers
- name: "๐ Bootstrap the break-glass instance admin"
include_tasks: 03_breakglass.yml
when: IS_STACK_HOST | bool
- name: "๐ฎ Provision, apply and validate the crossposter"
when: OPENPOST_CROSSPOSTER_ENABLED | bool
block:
- name: "๐ Provision the crossposter API token"
include_tasks: crossposter/provision.yml
when: IS_STACK_HOST | bool
- name: "โ
Apply and validate the crossposter"
include_tasks: crossposter/apply.yml