Skip to content

Commit

Permalink
Merge pull request #139 from billabongrob/workaround-138-windows-tele…
Browse files Browse the repository at this point in the history
…graf

adjustments for Windows >= 1.15
  • Loading branch information
dj-wasabi authored Dec 23, 2020
2 parents 8d25c09 + 4e31a33 commit 4d57c29
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 23 additions & 1 deletion tasks/configure_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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', '>=')

0 comments on commit 4d57c29

Please sign in to comment.