/
main.yml
101 lines (79 loc) · 2.45 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
# file: tasks/main.yml
# Top-level installer for Fluentd.
#
# @see http://docs.treasuredata.com/articles/td-agent
#
- name: set role variables, if necessary
include: set-role-variables.yml
- name: delegate to APT system for installation
include: use-apt.yml
when: ansible_pkg_mgr == "apt"
- name: delegate to YUM system for installation
include: use-yum.yml
when: ansible_pkg_mgr == "yum"
- name: mkdir for conf.d
file:
path: /etc/td-agent/conf.d
state: directory
owner: td-agent
group: td-agent
- name: rename default td-agent.conf
command: creates="/etc/td-agent/td-agent.conf.bak" mv /etc/td-agent/td-agent.conf /etc/td-agent/td-agent.conf.bak
- name: copy new td-agent.conf from role's default
copy:
src: ../files/td-agent.conf
dest: /etc/td-agent/td-agent.conf
owner: td-agent
group: td-agent
when: tdagent_conf_copy is not defined and tdagent_conf_template is not defined
notify:
- reload td-agent
- name: copy new "td-agent.conf" verbatim from main playbook's
copy:
src: "{{ playbook_dir }}/{{ tdagent_conf_copy }}"
dest: /etc/td-agent/td-agent.conf
owner: td-agent
group: td-agent
when: tdagent_conf_copy is defined
notify:
- reload td-agent
- name: copy (from template) new "td-agent.conf" from main playbook's
template:
src: "{{ playbook_dir }}/{{ tdagent_conf_template }}"
dest: /etc/td-agent/td-agent.conf
owner: td-agent
group: td-agent
when: tdagent_conf_template is defined
notify:
- reload td-agent
- name: copy other config files from playbook's, if any
template:
src: "{{ playbook_dir }}/{{ item.value.src }}"
dest: "/etc/td-agent/conf.d/{{ item.value.dest }}"
owner: td-agent
group: td-agent
with_dict: '{{ tdagent_conf_others | default({}) }}'
notify:
- reload td-agent
# GEM installed on:
# /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/
- name: install plugins, if any
gem:
name: "{{ item }}"
executable: /opt/td-agent/embedded/bin/fluent-gem
state: latest
user_install: no
with_items: "{{ tdagent_plugins | default([]) }}"
notify:
- restart td-agent
- name: install plugins with specified versions, if any
gem:
name: "{{ item.value.name }}"
executable: /opt/td-agent/embedded/bin/fluent-gem
state: present
version: "{{ item.value.version }}"
user_install: no
with_dict: "{{ tdagent_plugins_versions | default({}) }}"
notify:
- restart td-agent