diff options
author | Stefan Joosten <stefan@sjoosten.nl> | 2016-08-25 16:21:09 +0200 |
---|---|---|
committer | Stefan Joosten <stefan@sjoosten.nl> | 2016-08-25 16:21:09 +0200 |
commit | b331fee529dc21d54b3a495d6fa68029a3920648 (patch) | |
tree | 1711f4d4f76f4b47b618cfa613d0ec7cad3b1941 /tasks | |
parent | 819bb41873e49c520fc4506dfc00d46b6e849f44 (diff) | |
download | ansible-teamspeak-b331fee529dc21d54b3a495d6fa68029a3920648.tar.gz ansible-teamspeak-b331fee529dc21d54b3a495d6fa68029a3920648.tar.xz ansible-teamspeak-b331fee529dc21d54b3a495d6fa68029a3920648.zip |
Add logic to install a TeamSpeak 3 Server License file to the target host. Fixes issue #3.
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/install_license.yml | 18 | ||||
-rw-r--r-- | tasks/main.yml | 26 |
2 files changed, 42 insertions, 2 deletions
diff --git a/tasks/install_license.yml b/tasks/install_license.yml new file mode 100644 index 0000000..b54b551 --- /dev/null +++ b/tasks/install_license.yml @@ -0,0 +1,18 @@ +--- +# License install tasks for role teamspeak + +- name: "License : Create directory for license" + file: + path: "{{ teamspeak_licensepath }}" + state: directory + when: teamspeak_licensepath is not none + +- name: "License : Copy the license file" + copy: + src: licensekey.dat + dest: "{{ teamspeak_licensepath if teamspeak_licensepath is not none else ts3server_dir }}/licensekey.dat" + owner: "{{ teamspeak.user }}" + group: "{{ teamspeak.user }}" + mode: 0400 + notify: + - Restart TeamSpeak 3 Server diff --git a/tasks/main.yml b/tasks/main.yml index 0eaa630..9e619fc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,16 +15,38 @@ # Installation of TeamSpeak 3 Server - include: install.yml +# Store the TeamSpeak 3 Server directory in a short variable +- name: "Set TeamSpeak 3 Server directory fact" + set_fact: + ts3server_dir: "{{ teamspeak.home }}/{{ teamspeak.symlink }}/teamspeak3-server_linux_amd64" + +# License file management + # Install a license file +- include: install_license.yml + when: teamspeak_use_license + + # Remove a possible leftover license file when teamspeak_use_license is disabled. + # The default is to look for it in the TeamSpeak 3 Server directory, so + # we remove it there if the option has been disabled. +- name: "License : Clean up license in TeamSpeak 3 Server directory if needed" + file: + path: "{{ ts3server_dir }}/licensekey.dat" + state: absent + when: not teamspeak_use_license +# End of license file management + # Configuration of TeamSpeak 3 Server (if requested) + # Create configuration file - include: config.yml when: teamspeak_ini_enabled -# Clean-up a lingering configuration file if we don't need it anymore -- name: Clean-up configuration + # Clean-up a lingering configuration file if we don't need it anymore +- name: "Configuration : Clean-up old configuration file if needed" file: path: "{{ teamspeak.home }}/{{ teamspeak.symlink }}/teamspeak3-server_linux_amd64/{{ teamspeak_ini_filename }}" state: absent when: not teamspeak_ini_enabled +# End of configuration # Perform the running of handlers now # So we can do "Reload systemd" (and possibly queued clean-up) |