main.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ---
  2. # TODO: Update fluentd install and configuration when packaging is complete
  3. - name: download and install td-agent
  4. yum:
  5. name: 'http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm'
  6. state: present
  7. - name: Verify fluentd plugin installed
  8. command: '/opt/td-agent/embedded/bin/gem query -i fluent-plugin-kubernetes'
  9. register: _fluent_plugin_check
  10. failed_when: false
  11. changed_when: false
  12. - name: install Kubernetes fluentd plugin
  13. command: '/opt/td-agent/embedded/bin/gem install fluent-plugin-kubernetes'
  14. when: _fluent_plugin_check.rc == 1
  15. - name: Creates directories
  16. file:
  17. path: "{{ item }}"
  18. state: directory
  19. group: 'td-agent'
  20. owner: 'td-agent'
  21. mode: 0755
  22. with_items: ['/etc/td-agent/config.d']
  23. - name: Add include to td-agent configuration
  24. lineinfile:
  25. dest: '/etc/td-agent/td-agent.conf'
  26. regexp: '^@include config.d'
  27. line: '@include config.d/*.conf'
  28. state: present
  29. - name: install Kubernetes fluentd configuration file
  30. template:
  31. src: kubernetes.conf.j2
  32. dest: /etc/td-agent/config.d/kubernetes.conf
  33. group: 'td-agent'
  34. owner: 'td-agent'
  35. mode: 0444
  36. - name: ensure td-agent is running
  37. service:
  38. name: 'td-agent'
  39. state: started
  40. enabled: yes