initial commit
This commit is contained in:
41
tasks/31-set-query-password.yml
Normal file
41
tasks/31-set-query-password.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
|
||||
- name: "check if installed-file"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ ts3_base_dir }}/.ts3_installed"
|
||||
register: ts3_installed_file
|
||||
|
||||
- name: "Set query password"
|
||||
when:
|
||||
- "ts3_installed_file.stat.exists == false"
|
||||
block:
|
||||
- name: "Ensure parameter passing is enabled"
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ ts3_base_dir }}/ts3server_startscript.sh"
|
||||
regexp: '^COMMANDLINE_PARAMETERS='
|
||||
line: 'COMMANDLINE_PARAMETERS="$2"'
|
||||
|
||||
- name: "Generate password"
|
||||
ansible.builtin.set_fact:
|
||||
ts3_query_password: "{{ lookup('ansible.builtin.password', '/dev/null chars=digits,ascii_letters length=32') }}"
|
||||
|
||||
- name: "Run teamspeak with modified password"
|
||||
become: true
|
||||
become_user: "{{ ts3_user }}"
|
||||
shell:
|
||||
cmd: "/bin/bash ts3server_startscript.sh start serveradmin_password={{ ts3_query_password }}"
|
||||
chdir: "{{ ts3_base_dir }}"
|
||||
|
||||
- name: "Stop teamspeak"
|
||||
become: true
|
||||
become_user: "{{ ts3_user }}"
|
||||
shell:
|
||||
cmd: "/bin/bash ts3server_startscript.sh stop"
|
||||
chdir: "{{ ts3_base_dir }}"
|
||||
|
||||
- name: "write tatoo file"
|
||||
ansible.builtin.template:
|
||||
src: "installed-version.txt.j2"
|
||||
dest: "{{ ts3_base_dir }}/.ts3_installed"
|
||||
owner: "{{ ts3_user }}"
|
||||
group: "{{ ts3_user }}"
|
||||
Reference in New Issue
Block a user