feat(pretix): add ansible role and playbook
This commit is contained in:
		
							
								
								
									
										86
									
								
								roles/pretix/defaults/main/config.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								roles/pretix/defaults/main/config.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,86 @@
 | 
			
		||||
---
 | 
			
		||||
pretix_config_instance_name: "My pretix installation"
 | 
			
		||||
pretix_config_url: "https://pretix.example.org"
 | 
			
		||||
pretix_config_currency: "EUR"
 | 
			
		||||
pretix_config_data_dir: "{{ pretix_data_dir }}"
 | 
			
		||||
pretix_config_trust_x_forwarded_for: "on"
 | 
			
		||||
pretix_config_trust_x_forwarded_proto: "on"
 | 
			
		||||
 | 
			
		||||
pretix_config_wsgi_name: "pretix"
 | 
			
		||||
pretix_config_wsgi_workers: 4
 | 
			
		||||
pretix_config_wsgi_max_requests: 100
 | 
			
		||||
pretix_config_wsgi_log_level: "info"
 | 
			
		||||
pretix_config_wsgi_bind_addr: "127.0.0.1:8345"
 | 
			
		||||
pretix_config_worker_log_level: "{{ pretix_config_wsgi_log_level }}"
 | 
			
		||||
 | 
			
		||||
pretix_config_database_backend: postgresql
 | 
			
		||||
pretix_config_database_name: pretix
 | 
			
		||||
pretix_config_database_user: pretix
 | 
			
		||||
pretix_config_database_password: ~
 | 
			
		||||
pretix_config_database_host: ""
 | 
			
		||||
 | 
			
		||||
pretix_config_mail_host: ~
 | 
			
		||||
pretix_config_mail_from: "tickets@example.org"
 | 
			
		||||
pretix_config_mail_user: ~
 | 
			
		||||
pretix_config_mail_password: ~
 | 
			
		||||
pretix_config_mail_tls: true
 | 
			
		||||
pretix_config_mail_ssl: false
 | 
			
		||||
 | 
			
		||||
pretix_config_redis_location: ~
 | 
			
		||||
pretix_config_redis_sessions: true
 | 
			
		||||
 | 
			
		||||
pretix_config_celery_backend: ~
 | 
			
		||||
pretix_config_celery_broker: ~
 | 
			
		||||
 | 
			
		||||
pretix_app_config:
 | 
			
		||||
  url: "{{ pretix_config_url }}"
 | 
			
		||||
  instance_name: "{{ pretix_config_instance_name }}"
 | 
			
		||||
  datadir: "{{ pretix_config_data_dir }}"
 | 
			
		||||
  trust_x_forwarded_for: "{{ pretix_config_trust_x_forwarded_for }}"
 | 
			
		||||
  trust_x_forwarded_proto: "{{ pretix_config_trust_x_forwarded_proto }}"
 | 
			
		||||
  currency: "{{ pretix_config_currency }}"
 | 
			
		||||
 | 
			
		||||
pretix_database_config:
 | 
			
		||||
  backend: "{{ pretix_config_database_backend }}"
 | 
			
		||||
  name: "{{ pretix_config_database_name }}"
 | 
			
		||||
  user: "{{ pretix_config_database_user }}"
 | 
			
		||||
  password: "{{ pretix_config_database_password }}"
 | 
			
		||||
  host: "{{ pretix_config_database_host }}"
 | 
			
		||||
 | 
			
		||||
pretix_mail_minimal_config:
 | 
			
		||||
  host: "{{ pretix_config_mail_host }}"
 | 
			
		||||
  from: "{{ pretix_config_mail_from }}"
 | 
			
		||||
pretix_mail_config: >-2
 | 
			
		||||
  {{ pretix_mail_minimal_config
 | 
			
		||||
    | combine({'user': pretix_config_mail_user} if pretix_config_mail_user else {})
 | 
			
		||||
    | combine({'password': pretix_config_mail_password} if pretix_config_mail_password else {})
 | 
			
		||||
    | combine({'ssl': pretix_config_mail_ssl | bool | ternary('on', 'off')} if pretix_config_mail_ssl else {})
 | 
			
		||||
    | combine({'tls': pretix_config_mail_tls | bool | ternary('on', 'off')} if pretix_config_mail_tls else {})
 | 
			
		||||
  }}
 | 
			
		||||
 | 
			
		||||
pretix_redis_config:
 | 
			
		||||
  location: "{{ pretix_config_redis_location }}"
 | 
			
		||||
  sessions: "{{ pretix_config_redis_sessions | bool | ternary('true', 'false') }}"
 | 
			
		||||
 | 
			
		||||
pretix_celery_config:
 | 
			
		||||
  backend: "{{ pretix_config_celery_backend }}"
 | 
			
		||||
  broker: "{{ pretix_config_celery_broker }}"
 | 
			
		||||
 | 
			
		||||
pretix_config: {}
 | 
			
		||||
pretix_default_config:
 | 
			
		||||
  pretix: "{{ pretix_app_config }}"
 | 
			
		||||
  database: "{{ pretix_database_config }}"
 | 
			
		||||
  mail: "{{ pretix_mail_config }}"
 | 
			
		||||
  redis: "{{ pretix_redis_config }}"
 | 
			
		||||
  celery: "{{ pretix_celery_config }}"
 | 
			
		||||
 | 
			
		||||
pretix_config_merged: >-2
 | 
			
		||||
  {{ pretix_default_config | combine(pretix_config | default({}), recursive=True) }}
 | 
			
		||||
 | 
			
		||||
pretix_config_file_content: |+2
 | 
			
		||||
  {% for kv in (pretix_config_merged | dict2items) %}
 | 
			
		||||
  [{{ kv.key }}]
 | 
			
		||||
  {% for entry in ((kv.value | default({}, true)) | dict2items) %}
 | 
			
		||||
  {{ entry.key }}={{ entry.value }}
 | 
			
		||||
  {% endfor %}
 | 
			
		||||
  {% endfor %}
 | 
			
		||||
							
								
								
									
										16
									
								
								roles/pretix/defaults/main/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								roles/pretix/defaults/main/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
---
 | 
			
		||||
pretix_version: "2025.7.1"
 | 
			
		||||
pretix_state: "present"
 | 
			
		||||
pretix_deployment_method: "systemd"
 | 
			
		||||
 | 
			
		||||
pretix_config_file: "/etc/pretix/pretix.cfg"
 | 
			
		||||
pretix_config_file_owner: "{{ pretix_user_id }}"
 | 
			
		||||
pretix_config_file_group: "{{ pretix_group_id }}"
 | 
			
		||||
pretix_config_file_mode: "0640"
 | 
			
		||||
pretix_config_dir: "{{ pretix_config_file | dirname }}"
 | 
			
		||||
pretix_install_dir: "/var/lib/pretix"
 | 
			
		||||
pretix_virtualenv_dir: "{{ pretix_install_dir }}/virtualenv"
 | 
			
		||||
pretix_data_dir: "{{ pretix_install_dir }}/data"
 | 
			
		||||
pretix_media_dir: "{{ pretix_data_dir }}/media"
 | 
			
		||||
 | 
			
		||||
pretix_plugins: []
 | 
			
		||||
							
								
								
									
										22
									
								
								roles/pretix/defaults/main/system_packages.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								roles/pretix/defaults/main/system_packages.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
---
 | 
			
		||||
pretix_debian_packages:
 | 
			
		||||
  - "git"
 | 
			
		||||
  - "build-essential"
 | 
			
		||||
  - "python3-dev"
 | 
			
		||||
  - "python3-venv"
 | 
			
		||||
  - "python3"
 | 
			
		||||
  - "python3-pip"
 | 
			
		||||
  - "libxml2-dev"
 | 
			
		||||
  - "libxslt1-dev"
 | 
			
		||||
  - "libffi-dev"
 | 
			
		||||
  - "zlib1g-dev"
 | 
			
		||||
  - "libssl-dev"
 | 
			
		||||
  - "gettext"
 | 
			
		||||
  - "libpq-dev"
 | 
			
		||||
  - "libjpeg-dev"
 | 
			
		||||
  - "libopenjp2-7-dev"
 | 
			
		||||
  - "nodejs"
 | 
			
		||||
 | 
			
		||||
pretix_packages:
 | 
			
		||||
  "debian":
 | 
			
		||||
    "12": "{{ pretix_debian_packages }}"
 | 
			
		||||
							
								
								
									
										50
									
								
								roles/pretix/defaults/main/systemd.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								roles/pretix/defaults/main/systemd.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
---
 | 
			
		||||
pretix_systemd_unit_description: "pretix web service"
 | 
			
		||||
pretix_systemd_unit_after: "network.target"
 | 
			
		||||
pretix_systemd_unit_file_path: >-2
 | 
			
		||||
  /etc/systemd/system/{{ pretix_systemd_service_name }}
 | 
			
		||||
 | 
			
		||||
pretix_systemd_service_name: "pretix.service"
 | 
			
		||||
pretix_systemd_service_user: "{{ pretix_user }}"
 | 
			
		||||
pretix_systemd_service_group: "{{ pretix_user }}"
 | 
			
		||||
pretix_systemd_service_environment:
 | 
			
		||||
  VIRTUAL_ENV: "{{ pretix_virtualenv_dir }}"
 | 
			
		||||
  PATH: "{{ pretix_virtualenv_dir }}/bin:/usr/local/bin:/usr/bin:/bin"
 | 
			
		||||
pretix_systemd_service_working_directory: "{{ pretix_install_dir }}"
 | 
			
		||||
pretix_systemd_service_exec_start: >-2
 | 
			
		||||
  {{ pretix_virtualenv_dir }}/bin/gunicorn pretix.wsgi
 | 
			
		||||
  --name {{ pretix_config_wsgi_name }}
 | 
			
		||||
  --workers {{ pretix_config_wsgi_workers }}
 | 
			
		||||
  --max-requests {{ pretix_config_wsgi_max_requests }}
 | 
			
		||||
  --log-level={{ pretix_config_wsgi_log_level }}
 | 
			
		||||
  --bind={{ pretix_config_wsgi_bind_addr }}
 | 
			
		||||
pretix_systemd_service_restart: "on-failure"
 | 
			
		||||
 | 
			
		||||
pretix_systemd_install_wanted_by: "multi-user.target"
 | 
			
		||||
 | 
			
		||||
# pretix worker
 | 
			
		||||
pretix_worker_systemd_service_name: "pretix-worker.service"
 | 
			
		||||
pretix_worker_systemd_service_description: "pretix worker service"
 | 
			
		||||
pretix_worker_systemd_unit_file_path: >-2
 | 
			
		||||
  /etc/systemd/system/{{ pretix_worker_systemd_service_name }}
 | 
			
		||||
pretix_worker_systemd_service_exec_start: >-2
 | 
			
		||||
  {{ pretix_virtualenv_dir }}/bin/celery
 | 
			
		||||
  -A pretix.celery_app worker
 | 
			
		||||
  -l  {{ pretix_config_worker_log_level }}
 | 
			
		||||
 | 
			
		||||
# pretix cron
 | 
			
		||||
pretix_cron_systemd_service_name: "pretix-cron.service"
 | 
			
		||||
pretix_cron_systemd_service_description: "pretix cron service"
 | 
			
		||||
pretix_cron_systemd_unit_file_path: >-2
 | 
			
		||||
  /etc/systemd/system/{{ pretix_cron_systemd_service_name }}
 | 
			
		||||
pretix_cron_systemd_service_exec_start: >-2
 | 
			
		||||
  python3 -m pretix runperiodic
 | 
			
		||||
 | 
			
		||||
pretix_cron_systemd_timer_name: "pretix-cron.timer"
 | 
			
		||||
pretix_cron_systemd_timer_description: "pretix cron timer"
 | 
			
		||||
pretix_cron_systemd_timer_file_path: >-2
 | 
			
		||||
  /etc/systemd/system/{{ pretix_cron_systemd_timer_name }}
 | 
			
		||||
pretix_cron_systemd_timer_on_active_sec: 1800
 | 
			
		||||
pretix_cron_systemd_timer_on_startup_sec: >-2
 | 
			
		||||
  {{ pretix_cron_systemd_timer_on_active_sec }}
 | 
			
		||||
pretix_cron_systemd_timer_accuracy_sec: 60
 | 
			
		||||
							
								
								
									
										7
									
								
								roles/pretix/defaults/main/user.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								roles/pretix/defaults/main/user.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
---
 | 
			
		||||
pretix_user: "pretix"
 | 
			
		||||
pretix_user_system: true
 | 
			
		||||
pretix_user_create_home: false
 | 
			
		||||
 | 
			
		||||
pretix_user_id: "{{ pretix_user_info.uid | default(pretix_user) }}"
 | 
			
		||||
pretix_group_id: "{{ pretix_user_info.group | default(pretix_user) }}"
 | 
			
		||||
							
								
								
									
										11
									
								
								roles/pretix/defaults/main/virtualenv.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								roles/pretix/defaults/main/virtualenv.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
---
 | 
			
		||||
pretix_virtualenv_state: "{{ pretix_state }}"
 | 
			
		||||
pretix_virtualenv_packages:
 | 
			
		||||
  - "pip"
 | 
			
		||||
  - "setuptools"
 | 
			
		||||
  - "wheel"
 | 
			
		||||
  - "gunicorn"
 | 
			
		||||
  - "pretix=={{ pretix_version }}"
 | 
			
		||||
 | 
			
		||||
pretix_virtualenv_site_packages: false
 | 
			
		||||
pretix_virtualenv_command: "python3 -m venv"
 | 
			
		||||
		Reference in New Issue
	
	Block a user