2024-08-14 00:41:24 +02:00
|
|
|
- name: Update default SELinux contexts.
|
2022-08-13 17:50:54 +02:00
|
|
|
community.general.sefcontext:
|
2024-08-14 00:41:24 +02:00
|
|
|
target: "{{ teamspeak_install_dir }}/data(/.*)?"
|
2020-08-10 01:37:13 +02:00
|
|
|
setype: "container_file_t"
|
|
|
|
selevel: "{{ teamspeak_selinux_level }}"
|
|
|
|
state: present
|
|
|
|
become: true
|
2024-08-14 00:41:24 +02:00
|
|
|
notify: "teamspeak selinux context changed"
|
2020-08-10 01:37:13 +02:00
|
|
|
|
2024-08-14 00:41:24 +02:00
|
|
|
- name: Create teamspeak install directory.
|
2022-08-13 17:50:54 +02:00
|
|
|
ansible.builtin.file:
|
2024-08-14 00:41:24 +02:00
|
|
|
path: "{{ teamspeak_install_dir }}"
|
2024-02-22 00:37:48 +01:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
2024-08-14 00:41:24 +02:00
|
|
|
state: directory
|
|
|
|
mode: "0700"
|
2020-08-10 01:37:13 +02:00
|
|
|
become: true
|
|
|
|
|
2024-08-14 00:41:24 +02:00
|
|
|
- name: Ensure teamspeak data directory exists.
|
|
|
|
block:
|
|
|
|
- name: Check teamspeak data directory path.
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: "{{ teamspeak_install_dir }}/data"
|
|
|
|
become: true
|
|
|
|
register: teamspeak_stat_data_dir
|
|
|
|
- name: Create teamspeak data directory.
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ teamspeak_install_dir }}/data"
|
|
|
|
owner: "{{ teamspeak_stat_data_dir.stat.uid | default('root') }}"
|
|
|
|
group: "{{ teamspeak_stat_data_dir.stat.gid | default('root') }}"
|
|
|
|
state: directory
|
|
|
|
mode: "0700"
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Open teamspeak ports.
|
|
|
|
ansible.posix.firewalld:
|
|
|
|
state: enabled
|
|
|
|
permanent: true
|
|
|
|
immediate: true
|
|
|
|
zone: public
|
|
|
|
port: "{{ item }}"
|
|
|
|
loop:
|
|
|
|
- "{{ teamspeak_voice_port }}/udp"
|
|
|
|
- "{{ teamspeak_filetransfer_port }}/tcp"
|
2020-08-10 01:37:13 +02:00
|
|
|
become: true
|
|
|
|
|
2024-08-14 00:41:24 +02:00
|
|
|
- name: Ensure container image is present on the host.
|
|
|
|
containers.podman.podman_image:
|
|
|
|
name: "{{ teamspeak_containerimage }}"
|
|
|
|
state: present
|
|
|
|
tag: "{{ teamspeak_image_tag }}"
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Create teamspeak container file.
|
2022-08-13 17:50:54 +02:00
|
|
|
ansible.builtin.template:
|
2024-08-14 00:41:24 +02:00
|
|
|
src: teamspeak.container.j2
|
|
|
|
dest: "/etc/containers/systemd/teamspeak.container"
|
2024-02-22 00:37:48 +01:00
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
2024-08-14 00:41:24 +02:00
|
|
|
mode: "0644"
|
2020-08-10 01:37:13 +02:00
|
|
|
become: true
|
2024-08-14 00:41:24 +02:00
|
|
|
notify: "teamspeak service changed"
|
2020-08-10 01:37:13 +02:00
|
|
|
|
2024-08-14 00:41:24 +02:00
|
|
|
- name: Flush handlers
|
|
|
|
ansible.builtin.meta: flush_handlers
|
|
|
|
|
|
|
|
- name: Ensure teamspeak service is started.
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
state: started
|
|
|
|
enabled: true
|
|
|
|
name: teamspeak.service
|
|
|
|
daemon_reload: true
|
2020-08-10 01:37:13 +02:00
|
|
|
become: true
|