ansible-playbooks/peertube-server/playbook.yaml

66 lines
No EOL
2 KiB
YAML

- name: Create directory and templated file
hosts: nuculabs
become: yes
become_method: sudo
vars_files:
- variables.yaml
tasks:
# Create necessary directories.
- name: Create PeerTube data directory
ansible.builtin.file:
path: "/{{ peertube.data_directory }}"
state: directory
mode: '0755'
ignore_errors: true
- name: Create PeerTube config directory
ansible.builtin.file:
path: "/{{ peertube.config_directory }}"
state: directory
mode: '0754'
ignore_errors: true
- name: Create PostgresSQL directory
ansible.builtin.file:
path: "/{{ postgres.postgres_directory }}"
state: directory
mode: '0754'
ignore_errors: true
# Ensure dependencies are installed
- name: Ensure Podman is installed
ansible.builtin.package:
name: podman
state: present
- name: Ensure Udica is installed
ansible.builtin.package:
name: udica
state: present
- name: Ensure container-selinux is installed
ansible.builtin.package:
name: container-selinux
state: present
# Pull docker images
- name: Pull PeerTube image
containers.podman.podman_image:
name: "{{ peertube.image_name }}"
state: present
- name: Pull Postgres image
containers.podman.podman_image:
name: "{{ postgres.image_name }}"
state: present
- name: Pull Redis image
containers.podman.podman_image:
name: "{{ redis.image_name }}"
state: present
# Load SELinux policies
- name: Add firewall ports
block:
- name: Create a firewalld service file (if it doesn't exist)
ansible.posix.firewalld:
src: ./templates/firewall/peertube.xml
dest: /etc/firewalld/services/peertube.xml
state: enabled
notify: reload firewalld
handlers:
- name: reload firewalld
ansible.posix.firewalld:
state: reloaded