公式ページを見ると
# Amazon Linux 2
$ curl -L https://toolbelt.treasuredata.com/sh/install-amazon2-td-agent3.sh | sh
とinstall-amazon2-td-agent3.sh
を実行しているだけだったので、このファイルを見ながらAnsibleに書き換えました。
td-agentというroleを作っています。
roles/td-agent/tasks/main.yml
---
- name: add GPG key
become: yes
rpm_key:
state: present
key: https://packages.treasuredata.com/GPG-KEY-td-agent
- name: add treasure data repository to yum
copy:
src: td.repo
dest: /etc/yum.repos.d/td.repo
mode: "0644"
become: yes
- name: install the toolbelt
yum:
name: td-agent
become: yes
- name: enable td-agent service
become: yes
systemd:
name: td-agent
enabled: yes
state: started
daemon_reload: yes
roles/td-agent/files/td.repo
[treasuredata]
name=TreasureData
baseurl=http://packages.treasuredata.com/3/amazon/2/\$releasever/\$basearch
gpgcheck=1
gpgkey=https://packages.treasuredata.com/GPG-KEY-td-agent