infrastructure/roles/teamspeak/tasks/main.yml

74 lines
2 KiB
YAML
Raw Normal View History

- name: Update default SELinux contexts.
2022-08-13 17:50:54 +02:00
community.general.sefcontext:
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
notify: "teamspeak selinux context changed"
2020-08-10 01:37:13 +02:00
- name: Create teamspeak install directory.
2022-08-13 17:50:54 +02:00
ansible.builtin.file:
path: "{{ teamspeak_install_dir }}"
owner: "root"
group: "root"
state: directory
mode: "0700"
2020-08-10 01:37:13 +02:00
become: true
- 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
- 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:
src: teamspeak.container.j2
dest: "/etc/containers/systemd/teamspeak.container"
owner: "root"
group: "root"
mode: "0644"
2020-08-10 01:37:13 +02:00
become: true
notify: "teamspeak service changed"
2020-08-10 01:37:13 +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