---

argument_specs:

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

      # Container image settings
      pretix_image:
        description:
          - OCI Container image name for Pretix
        type: str
        default: docker.io/pretix/standalone
      pretix_image_tag:
        description:
          - OCI Container image tag for Pretix
        type: str
        default: "2025.2"
      pretix_cache_image:
        description:
          - OCI Container image name for Redis
        type: str
        default: docker.io/valkey/valkey
      pretix_cache_image_tag:
        description:
          - OCI Container image tag for Redis
        type: str
        default: "8"
      pretix_http_hostpaddr:
        description:
          - Host address to map to Pretix http port
        type: str
        default: "[::1]"
      pretix_http_hostport:
        description:
          - Host port to map to Pretix http port
        type: int
        default: 8080
      pretix_container_uid:
        description:
          - UID under which Pretix runs inside the container.
          - On the host, this is offset by O(pretix_subuid_begin).
          - You should not need to change this.
        type: int
        default: 15371
      pretix_container_gid:
        description:
          - GID under which Pretix runs inside the container.
          - On the host, this is offset by O(pretix_subgid_begin).
          - You should not need to change this.
        type: int
        default: 15371
      pretix_watchtower_enabled:
        description:
          - "Whether to enable automatic container updates through L(Watchtower,https://containrrr.dev/watchtower/)."
          - "If this is true, you should set O(pretix_image_tag) to something other than V(latest) or V(stable)."
          - "See also: M(s3lph.conference.watchtower)."
        type: bool
        default: false

      # System user settings
      pretix_system_group:
        description:
          - Name of the Pretix system group.
        type: str
        default: pretix
      pretix_system_user:
        description:
          - Name of the Pretix system user.
        type: str
        default: pretix
      pretix_system_home:
        description:
          - Home of the Pretix system user.
          - The persistent Pretix data will be stored here.
        type: str
        default: /var/lib/pretix
      pretix_subuid_begin:
        description:
          - First subordinate uid for the Pretix system user.
        type: int
        default: 100000
      pretix_subuid_count:
        description:
          - Number of subordinate uids for the Pretix system user.
        type: int
        default: 65536
      pretix_subgid_begin:
        description:
          - First subordinate gid for the Pretix system user.
        type: int
        default: 100000
      pretix_subgid_count:
        description:
          - Number of subordinate gids for the Pretix system user.
        type: int
        default: 65536

      # Database settings
      pretix_postgresql_username:
        description:
          - PostgreSQL username to be used by Pretix.
        type: str
        default: pretix
      #pretix_postgresql_password:
      #  description:
      #    - PostgreSQL password to be used by Pretix.
      #  type: str
      #  required: true
      pretix_postgresql_database:
        description:
          - PostgreSQL database to be used by Pretix.
        type: str
        default: pretix

      # pretix.cfg: main config section
      pretix_instance_name:
        description:
          - Name of the Pretix installation.
        type: str
        default: My pretix installation
      pretix_url:
        description:
          - Base URL of the Pretix installation.
        type: str
        default: https://pretix.example.org
      pretix_currency:
        description:
          - Currency to use in the Pretix installation.
        type: str
        default: EUR
      pretix_registration:
        description:
          - Whether user signup in the Pretix installation should be enabled.
        type: bool
        default: false

      # pretix.cfg: mail config section
      pretix_mail_from:
        description:
          - Address from which Pretix sends e-mail.
        type: str
        default: pretix@example.org
      pretix_mail_host:
        description:
          - Host over which Pretix sends e-mail.
        type: str
        default: 172.17.0.1
      pretix_mail_port:
        description:
          - Port over which Pretix sends e-mail.
          - "The default depends on the value if O(pretix_tls_mode):"
          - "O(pretix_tls_mode=none): V(25)"
          - "O(pretix_tls_mode=tls): V(465)"
          - "O(pretix_tls_mode=starttls): V(587)"
        type: int
        default: 0
      pretix_mail_tls_mode:
        description:
          - TLS mode to use when Pretix sends e-mail.
        type: str
        choices: ["none", "tls", "starttls"]
        default: "none"
      pretix_mail_username:
        description:
          - If present, the username Pretix uses to send e-mail.
          - "Only takes effect if O(pretix_mail_password) is set as well."
        type: str
        default: null
      pretix_mail_password:
        description:
          - If present, the password Pretix uses to send e-mail.
          - "Only takes effect if O(pretix_mail_username) is set as well."
        type: str
        default: null

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

      # Cronjob
      pretix_cron:
        description:
          - The cron expression of when to execute Pretix jobs.
        type: str
        default: "*/15 * * * *"