LoginSignup
4
3

More than 5 years have passed since last update.

win_msiモジュールに泣かされて死んだ俺のdatadog agentインストール入門

Posted at

俺です。

Windows版データワンワンAgentをAnsibleのwin_msiモジュール使って
インストールしようとしたところ、うまく動かなかった(msiexecプロセスがバックグラウンド起動してだんまりだった)のでrawで叩き込みました。
登録対象のdd-agentホス名をinstance-idで登録しています。

冪等性はあるように見えてないです。
2回目に実行するとmsiexecがバックグラウンド起動しっぱなしになってしまいます。

- name: Download datadog agent
  win_get_url: >-
    url="https://<dd-agent-utl>/ddagent-cli.amd64.msi"
    dest=C:/temp/ddagent-cli.amd64.msi
    force=no
- name: get Instance ID From metadata
  raw:  Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/instance-id
  register: instance_id
- name: install datadog agent for windows
  raw: msiexec /qn /i C:\temp\ddagent-cli.amd64.msi APIKEY="{{ datadog_api_key }}" HOSTNAME="{{ instance_id.stdout_lines[0].encode('utf-8') }}"
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3