main.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ---
  2. - fail:
  3. msg: "fluentd node is not yet supported on atomic hosts"
  4. when: openshift.common.is_containerized | bool
  5. # TODO: Update fluentd install and configuration when packaging is complete
  6. - name: download and install td-agent
  7. action: "{{ ansible_pkg_mgr }} name='http://packages.treasuredata.com/2/redhat/7/x86_64/td-agent-2.2.0-0.x86_64.rpm' state=present"
  8. - name: Verify fluentd plugin installed
  9. command: '/opt/td-agent/embedded/bin/gem query -i fluent-plugin-kubernetes'
  10. register: _fluent_plugin_check
  11. failed_when: false
  12. changed_when: false
  13. - name: install Kubernetes fluentd plugin
  14. command: '/opt/td-agent/embedded/bin/gem install fluent-plugin-kubernetes'
  15. when: _fluent_plugin_check.rc == 1
  16. - name: Override td-agent configuration file
  17. template:
  18. src: td-agent.j2
  19. dest: /etc/sysconfig/td-agent
  20. group: 'td-agent'
  21. owner: 'td-agent'
  22. mode: 0444
  23. - name: Creates directories
  24. file:
  25. path: "{{ item }}"
  26. state: directory
  27. group: 'td-agent'
  28. owner: 'td-agent'
  29. mode: 0755
  30. with_items: ['/etc/td-agent/config.d', '/var/log/td-agent/tmp']
  31. - name: Add include to td-agent configuration
  32. lineinfile:
  33. dest: '/etc/td-agent/td-agent.conf'
  34. regexp: '^@include config.d'
  35. line: '@include config.d/*.conf'
  36. state: present
  37. - name: install Kubernetes fluentd configuration file
  38. template:
  39. src: kubernetes.conf.j2
  40. dest: /etc/td-agent/config.d/kubernetes.conf
  41. group: 'td-agent'
  42. owner: 'td-agent'
  43. mode: 0444
  44. - name: ensure td-agent is running
  45. service:
  46. name: 'td-agent'
  47. state: started
  48. enabled: yes