diff options
| author | Stefan Joosten <stefan@sjoosten.nl> | 2016-08-26 00:31:49 +0200 | 
|---|---|---|
| committer | Stefan Joosten <stefan@sjoosten.nl> | 2016-08-26 00:31:49 +0200 | 
| commit | 9f7b61ea916c73b556d19b5c1d982ea9e5fb007f (patch) | |
| tree | 84c0ad246251245224e63de848742625d878f481 /tasks | |
| parent | be6b41e5c246d4c249c3d068b543a0f97326f3ac (diff) | |
| parent | 7ef374edd6f40c1d8a754fdd58dba22efb707932 (diff) | |
| download | ansible-teamspeak-9f7b61ea916c73b556d19b5c1d982ea9e5fb007f.tar.gz ansible-teamspeak-9f7b61ea916c73b556d19b5c1d982ea9e5fb007f.tar.xz ansible-teamspeak-9f7b61ea916c73b556d19b5c1d982ea9e5fb007f.zip  | |
Merge branch 'issue3'
Add the functionality to include a TeamSpeak 3 Server license file.
Close issue #3
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/config.yml | 5 | ||||
| -rw-r--r-- | tasks/install.yml | 14 | ||||
| -rw-r--r-- | tasks/install_license.yml | 18 | ||||
| -rw-r--r-- | tasks/main.yml | 26 | ||||
| -rw-r--r-- | tasks/ts3update.yml | 8 | 
5 files changed, 54 insertions, 17 deletions
diff --git a/tasks/config.yml b/tasks/config.yml index 3e9f003..3a9035a 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -1,10 +1,7 @@  ---  # configuration tasks for teamspeak -- name: Set TeamSpeak 3 Server directory fact -  set_fact: -    ts3server_dir: "{{ teamspeak.home }}/{{ teamspeak.symlink }}/teamspeak3-server_linux_amd64" -- name: Create TeamSpeak 3 Server configuration file +- name: "Configuration : Create TeamSpeak 3 Server configuration file"    template:      src: ts3server.ini.j2       dest: "{{ ts3server_dir }}/{{ teamspeak_ini_filename }}" diff --git a/tasks/install.yml b/tasks/install.yml index 1dcebb2..afd4c8b 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -2,7 +2,7 @@  # install tasks file for teamspeak  # Start of installation -- name: Create Teamspeak user +- name: "Install : Create Teamspeak user"    user:      name: "{{ teamspeak.user }}"      comment: "{{ teamspeak.comment }}" @@ -10,7 +10,7 @@      shell: "{{ teamspeak.shell }}"      system: yes -- name: Download TeamSpeak {{ teamspeak.version }} Server files +- name: "Install : Download TeamSpeak {{ teamspeak.version }} Server files"    get_url:      url: "http://dl.4players.de/ts/releases/{{ teamspeak.version }}/teamspeak3-server_linux_amd64-{{ teamspeak.version }}.tar.bz2"      dest: "{{ teamspeak.home }}/teamspeak3-server_linux_amd64-{{ teamspeak.version }}.tar.bz2" @@ -18,7 +18,7 @@      owner: "{{ teamspeak.user }}"      group: "{{ teamspeak.user }}" -- name: Create TeamSpeak {{ teamspeak.version }} Server directory +- name: "Install : Create TeamSpeak {{ teamspeak.version }} Server directory"    file:      path: "{{ teamspeak.home }}/teamspeak3-server_linux_amd64-{{ teamspeak.version }}"      state: directory @@ -27,7 +27,7 @@    register: mkdir  # If a new directory has been created, check for (current) user data. -- name: Checking for a currently installed TeamSpeak 3 Server with user data +- name: "Install : Checking for a currently installed TeamSpeak 3 Server with user data"    stat:      path: "{{ teamspeak.home }}/{{ teamspeak.symlink }}/teamspeak3-server_linux_amd64/files"    register: userdata @@ -38,7 +38,7 @@    when: userdata.stat.exists is defined and userdata.stat.exists == True  # Created a new directory? Extract the files into it. Overwrites existing. -- name: Extract TeamSpeak {{ teamspeak.version }} Server files +- name: "Install : Extract TeamSpeak {{ teamspeak.version }} Server files"    unarchive:      copy: no      src: "{{ teamspeak.home }}/teamspeak3-server_linux_amd64-{{ teamspeak.version }}.tar.bz2" @@ -47,7 +47,7 @@      group: "{{ teamspeak.user }}"    when: mkdir.changed -- name: Create/Update symlink to TeamSpeak {{ teamspeak.version }} Server +- name: "Install : Create/Update symlink to TeamSpeak {{ teamspeak.version }} Server"    file:      src: "{{ teamspeak.home }}/teamspeak3-server_linux_amd64-{{ teamspeak.version }}"      dest: "{{ teamspeak.home }}/{{ teamspeak.symlink }}" @@ -57,7 +57,7 @@    notify:      - Restart TeamSpeak 3 Server -- name: Install TeamSpeak 3 systemctl service file +- name: "Install : Install TeamSpeak 3 systemctl service file"    template:      src: teamspeak3-server.service.j2      dest: "{{ systemd_service_file_path }}/teamspeak3-server.service" diff --git a/tasks/install_license.yml b/tasks/install_license.yml new file mode 100644 index 0000000..25c9365 --- /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: "{{ teamspeak_license_srcfile }}" +    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)  diff --git a/tasks/ts3update.yml b/tasks/ts3update.yml index 2d5587f..e5eda4c 100644 --- a/tasks/ts3update.yml +++ b/tasks/ts3update.yml @@ -1,18 +1,18 @@  ---  # tasks file for teamspeak -- name: Check if a TeamSpeak 3 Server systemd service unit exists +- name: "Update : Check if a TeamSpeak 3 Server systemd service unit exists"    stat:      path: "{{ systemd_service_file_path }}/teamspeak3-server.service"    register: ts3_systemd_service -- name: Stop currently running TeamSpeak 3 Server instance +- name: "Update : Stop currently running TeamSpeak 3 Server instance"    service:      name: teamspeak3-server      state: stopped    when: ts3_systemd_service.stat.exists -- name: Copy existing TeamSpeak 3 Server data to new TeamSpeak {{ teamspeak.version }} Server directory +- name: "Update : Copy existing TeamSpeak 3 Server data to new TeamSpeak {{ teamspeak.version }} Server directory"    synchronize:      src: "{{ teamspeak.home }}/{{ teamspeak.symlink }}/teamspeak3-server_linux_amd64/"      dest: "{{ teamspeak.home }}/teamspeak3-server_linux_amd64-{{ teamspeak.version }}/teamspeak3-server_linux_amd64/" @@ -20,7 +20,7 @@    notify:      - Prune older TeamSpeak 3 Server versions -- name: Make sure ownership is set to {{ teamspeak.user }} +- name: "Update : Make sure ownership is set to {{ teamspeak.user }}"    file:      path: "{{ teamspeak.home }}/teamspeak3-server_linux_amd64-{{ teamspeak.version }}/teamspeak3-server_linux_amd64/"      state: directory  | 
