From 4e31a334a7d203b652c88b69c88930231c80adbf Mon Sep 17 00:00:00 2001 From: "Heckel, Robert J" Date: Wed, 23 Dec 2020 11:52:59 -0600 Subject: [PATCH] adjustments for Windows >= 1.15 --- README.md | 1 + tasks/configure_windows.yml | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f23b754..e281d0b 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ These properties set in how and what package will be installed. * `telegraf_agent_metric_buffer_limit`: The agent metric buffer limit. Default: 10000 (since v0.13) * `telegraf_agent_quiet`: Run Telegraf in quiet mode (error messages only). Default: `False` (since v0.13) * `telegraf_agent_logfile`: The agent logfile name. Default: '' (means to log to stdout) (since v1.1) +* `telegraf_agent_hostname`: The agent hostname. Default: `ansible_fqdn` * `telegraf_agent_omit_hostname`: Do no set the "host" tag in the agent. Default: `False` (since v1.1) ### Docker specific role variables: diff --git a/tasks/configure_windows.yml b/tasks/configure_windows.yml index 6e7b9ac..541fddf 100644 --- a/tasks/configure_windows.yml +++ b/tasks/configure_windows.yml @@ -20,11 +20,27 @@ when: - not file_info.stat.exists -- name: "Windows | Unzip file" +- name: "Windows | Unzip file (newer than 1.15)" win_unzip: src: '{{ telegraf_win_install_dir }}\telegraf-{{ telegraf_agent_version }}_windows_amd64.zip' dest: "{{ telegraf_win_install_dir }}" + creates: '{{ telegraf_win_install_dir }}\telegraf-{{ telegraf_agent_version }}\telegraf.exe' + when: telegraf_agent_version is version('1.15', '>=') + +- name: "Windows | Move extracted directory (newer than 1.15)" + win_copy: + src: '{{ telegraf_win_install_dir }}\telegraf-{{ telegraf_agent_version }}\' + dest: '{{ telegraf_win_install_dir }}\telegraf' + remote_src: yes + when: telegraf_agent_version is version('1.15', '>=') + +- name: "Windows | Unzip file" + win_unzip: + src: '{{ telegraf_win_install_dir }}\telegraf-{{ telegraf_agent_version }}_windows_amd64.zip' + dest: '{{ telegraf_win_install_dir }}' creates: '{{ telegraf_win_install_dir }}\telegraf\telegraf.exe' + delete_archive: yes + when: telegraf_agent_version is version('1.15', '<') - name: "Windows | Configure Telegraf" win_template: @@ -76,3 +92,9 @@ name: Telegraf start_mode: auto state: started + +- name: "Windows | Cleanup" + win_file: + path: '{{ telegraf_win_install_dir }}\telegraf-{{ telegraf_agent_version }}' + state: absent + when: telegraf_agent_version is version('1.15', '>=') \ No newline at end of file