---

argument_specs:

  main:
    version_added: "0.0.1"
    short_description: Install and configure Pretalx.
    description:
      - Install and configure the L(Pretalx,https://pretalx.com/p/about/) conference scheduling software.
      - "Execution of this role can be limited using the following tags:"
      - "C(role::pretalx:install): Install Pretalx, Valkey and PostgreSQL"
      - "C(role::pretalx): Apply all of the above."
    author: s3lph
    options:

      # Container image settings
      pretalx_image:
        description:
          - OCI Container image name for Pretalx
        type: str
        default: docker.io/pretalx/standalone
      pretalx_image_tag:
        description:
          - OCI Container image tag for Pretalx
        type: str
        default: "v2024.3.1"
      pretalx_cache_image:
        description:
          - OCI Container image name for Valkey
        type: str
        default: docker.io/valkey/valkey
      pretalx_cache_image_tag:
        description:
          - OCI Container image tag for Valkey
        type: str
        default: "8"
      pretalx_http_hostaddr:
        description:
          - Host address to map to Pretalx http port
        type: str
        default: "[::1]"
      pretalx_http_hostport:
        description:
          - Host port to map to Pretalx http port
        type: int
        default: 8081
      pretalx_container_uid:
        description:
          - UID under which Pretalx runs inside the container.
          - On the host, this is offset by O(pretalx_subuid_begin).
          - You should not need to change this.
        type: int
        default: 999
      pretalx_container_gid:
        description:
          - GID under which Pretalx runs inside the container.
          - On the host, this is offset by O(pretalx_subgid_begin).
          - You should not need to change this.
        type: int
        default: 999
      pretalx_watchtower_enabled:
        description:
          - "Whether to enable automatic container updates through L(Watchtower,https://containrrr.dev/watchtower/)."
          - "If this is true, you should set O(pretalx_image_tag) to something other than V(latest) or V(stable)."
          - "See also: M(s3lph.conference.watchtower)."
        type: bool
        default: false

      # System user settings
      pretalx_system_group:
        description:
          - Name of the Pretalx system group.
        type: str
        default: pretalx
      pretalx_system_user:
        description:
          - Name of the Pretalx system user.
        type: str
        default: pretalx
      pretalx_system_home:
        description:
          - Home of the Pretalx system user.
          - The persistent Pretalx data will be stored here.
        type: str
        default: /var/lib/pretalx
      pretalx_subuid_begin:
        description:
          - First subordinate uid for the Pretalx system user.
        type: int
        default: 200000
      pretalx_subuid_count:
        description:
          - Number of subordinate uids for the Pretalx system user.
        type: int
        default: 65536
      pretalx_subgid_begin:
        description:
          - First subordinate gid for the Pretalx system user.
        type: int
        default: 200000
      pretalx_subgid_count:
        description:
          - Number of subordinate gids for the Pretalx system user.
        type: int
        default: 65536

      # Database settings
      pretalx_postgresql_username:
        description:
          - PostgreSQL username to be used by Pretalx.
        type: str
        default: pretalx
      #pretalx_postgresql_password:
      #  description:
      #    - PostgreSQL password to be used by Pretalx.
      #  type: str
      #  required: true
      pretalx_postgresql_database:
        description:
          - PostgreSQL database to be used by Pretalx.
        type: str
        default: pretalx

      # pretalx.cfg: main config section
      pretalx_url:
        description:
          - Base URL of the Pretalx installation.
        type: str
        default: https://pretalx.example.org
      pretalx_timezone:
        description:
          - Time zone of the Pretalx instance
        type: str
        default: UTC

      # pretalx.cfg: mail config section
      pretalx_mail_from:
        description:
          - Address from which Pretalx sends e-mail.
        type: str
        default: pretalx@example.org
      pretalx_mail_host:
        description:
          - Host over which Pretalx sends e-mail.
        type: str
        default: 172.17.0.1
      pretalx_mail_port:
        description:
          - Port over which Pretalx sends e-mail.
          - "The default depends on the value if O(pretalx_tls_mode):"
          - "O(pretalx_tls_mode=none): V(25)"
          - "O(pretalx_tls_mode=tls): V(465)"
          - "O(pretalx_tls_mode=starttls): V(587)"
        type: int
        default: 0
      pretalx_mail_tls_mode:
        description:
          - TLS mode to use when Pretalx sends e-mail.
        type: str
        choices: ["none", "tls", "starttls"]
        default: "none"
      pretalx_mail_username:
        description:
          - If present, the username Pretalx uses to send e-mail.
          - "Only takes effect if O(pretalx_mail_password) is set as well."
        type: str
        default: null
      pretalx_mail_password:
        description:
          - If present, the password Pretalx uses to send e-mail.
          - "Only takes effect if O(pretalx_mail_username) is set as well."
        type: str
        default: null

      # pretalx.cfg: redis config section
      pretalx_valkey_db_offset:
        description:
          - Valkey database index offset to be used by Pretalx.
          - Pretalx uses this and the following two database indices.
        type: int
        default: 0