summaryrefslogtreecommitdiffstats
path: root/roles/fluentd_master/tasks/main.yml
blob: 43c499b4d39cb56f6aca85fefa90f475ace35e12 (plain)
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
---
# TODO: Update fluentd install and configuration when packaging is complete
- name: download and install td-agent
  yum:
    name: 'http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm'
    state: present
  when: ansible_pkg_mgr == "yum"

- name: download and install td-agent
  dnf:
    name: 'http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm'
    state: present
  when: ansible_pkg_mgr == "dnf"

- name: Verify fluentd plugin installed
  command: '/opt/td-agent/embedded/bin/gem query -i fluent-plugin-kubernetes'
  register: _fluent_plugin_check
  failed_when: false
  changed_when: false

- name: install Kubernetes fluentd plugin
  command: '/opt/td-agent/embedded/bin/gem install fluent-plugin-kubernetes'
  when: _fluent_plugin_check.rc == 1

- name: Creates directories
  file:
    path: "{{ item }}"
    state: directory
    group: 'td-agent'
    owner: 'td-agent'
    mode: 0755
  with_items: ['/etc/td-agent/config.d']

- name: Add include to td-agent configuration
  lineinfile:
    dest: '/etc/td-agent/td-agent.conf'
    regexp: '^@include config.d'
    line: '@include config.d/*.conf'
    state: present

- name: install Kubernetes fluentd configuration file
  template:
    src: kubernetes.conf.j2
    dest: /etc/td-agent/config.d/kubernetes.conf
    group: 'td-agent'
    owner: 'td-agent'
    mode: 0444

- name: wait for etcd to start up
  wait_for: port=4001 delay=10
  when: embedded_etcd | bool

- name: wait for etcd peer to start up
  wait_for: port=7001 delay=10
  when: embedded_etcd | bool

- name: ensure td-agent is running
  service:
    name: 'td-agent'
    state: started
    enabled: yes