Ansible role for a pretix manual installation.
Database: PostgreSQL (recommended) , MySQL (5.7 or newer) or MariaDB (10.2.7 or newer) or SQLite (not recommended for production)
Celery: Redis, RabbitMQ (or another specified in Celery docs )
Mail-Server (SMTP)
Variable Name
Function
Default value
Comment
pretix_user
User created for running the pretix service
pretix
pretix_group
Group for the user created for the pretix service
{{ pretix_user }}
pretix_version
Version that is going to be installed (required)
pretix_systemd_service_web_name
The name of the web systemd service file
pretix-web
pretix_systemd_service_worker_name
The name of the worker systemd service file
pretix-worker
pretix_gunicorn_worker
Number of worker that gunicorn runs
5
pretix_celery_concurrency
The name of the worker systemd service file
8
pretix_base_path
Installation base path
/opt/pretix
Without a trailing slash
pretix_config_path
Installation base path
{{ pretix_base_path }}/config
Without a trailing slash
pretix_venv_path
Python virtual environment path
{{ pretix_base_path }}/.venv
Should be a sub-directory of pretix_base_path
; without a trailing slash
pretix_venv_command
Command for creating the virtual environment
python3 -m venv
pretix_bind_address
Address gunicorn listens on (required)
either socket or host:port
pretix_cron_minute
Minutes for the cronjob that runs the management command runperiodic
15,45
should be between every minute and every hour
Configuration File (pretix.cfg)
The configuration is built up, following https://docs.pretix.eu/en/latest/admin/config.html .
Variable Name
Function
Default value
Comment
pretix_pretix_instance_name
Name of the pretix instance (required)
pretix_pretix_url
The installation’s full URL (required)
Without a trailing slash
pretix_pretix_currency
The default currency as a three-letter code
EUR
pretix_pretix_datadir
The local path to a data directory that will be used for storing user uploads and similar data
{{ pretix_base_path }}/data
pretix_pretix_trust_x_forwarded_for
Specifies whether the X-Forwarded-For
header can be trusted (useful for reverse proxy)
off
pretix_pretix_trust_x_forwarded_proto
Specifies whether the X-Forwarded-Proto
header can be trusted
off
You can also add any additional config to the pretix block via the pretix_pretix_additional_config
variable.
Variable Name
Function
Default value
Comment
pretix_locale_default
The system's default locale
en
pretix_locale_timezone
The system’s default timezone
UTC
as a pytz
name
Variable Name
Function
Default value
Comment
pretix_database_backend
The Database backend
One of postgresql
(recommended) , mysql
, oracle
or sqlite3
(not recommended for production)
pretix_database_name
The name of the database (required)
pretix_database_user
The user of the database (required when not using sqlite3)
pretix_database_password
The password of the user (required when not using sqlite3)
pretix_database_host
The host of the database (required when not using sqlite3)
pretix_database_port
The port used to connect to the database server (required when not using sqlite3)
pretix_database_galera
Indicates if the database backend is a MySQL/MariaDB Galera cluster
Use only if backend is mysql. Options: true/false
Variable Name
Function
Default value
Comment
pretix_mail_from
The e-mail address set as From
header in outgoing e-mails
pretix@{{ ansible_fqdn }}
pretix_mail_host
The host of the e-mail server
localhost
pretix_mail_port
The port used to connect to the mail server
25
pretix_mail_user
The user used to connect to the mail server
pretix_mail_password
The password of the user
pretix_mail_ssl
Use SSL/TLS for the connection to the mail server
off
pretix_mail_tls
Use STARTTLS for the connection to the mail server
off
pretix_mail_admins
List of E-Mail addresses that will be notified about every 500-error thrown by pretix
comma-separated list
Variable Name
Function
Default value
Comment
pretix_django_secret
Secret for Django (recommended)
Should be 50 character long string. If not provided pretix will generate one itself and save it to the filesystem.
pretix_django_debug
Whether Django should run in debug mode
false
Never enable in production!
pretix_django_profile
Enable code profiling for a random subset of requests.
Documentation
Redis server is required for metrics-collection.
Variable Name
Function
Default value
Comment
pretix_metrics_enabled
Whether metrics endpoint should be activated
false
true
/false
pretix_metrics_user
User for metrics endpoint (required when metrics endpoint is enabled)
pretix_metrics_passphrase
Passphrase for user for metrics endpoint (required when metrics endpoint is enabled)
Variable Name
Function
Default value
Comment
pretix_memcached_location
Location of memcached
Either a host:port combination or a socket file
Variable Name
Function
Default value
Comment
pretix_redis_location
The location of redis
in URL form (either redis://[:password]@localhost:6379/0
or unix://[:password]@/path/to/socket.sock?db=0
)
pretix_redis_session
Whether redis should be used as session storage
true
Variable Name
Function
Default value
Comment
pretix_celery_broker
URL for celery broker (required)
pretix_celery_backend
URL for celery backend (required)
Variable Name
Function
Default value
Comment
pretix_sentry_dsn
Sentry DSN (created by sentry installation)
You can put any blocks not mentioned above into the pretix_additional_config
variable. The value of this variable is put at the end of pretix.cfg
This role does not have any dependencies.
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts : servers
roles :
- {
role : em0lar.pretix,
pretix_version : " 3.7.0" ,
pretix_bind_address : " 127.0.0.1:8000" ,
pretix_pretix_instance_name : " Example Pretix" ,
pretix_pretix_url : " https://pretix.example.org" ,
pretix_database_backend : " postgresql" ,
pretix_database_name : " pretix" ,
pretix_database_user : " pretix" ,
pretix_database_password : " supersecurepassword" ,
pretix_database_host : " localhost" ,
pretix_celery_broker : " redis://localhost:6379/0" ,
pretix_celery_backend : " redis://localhost:6379/0"
}
GPL-3.0