main.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ---
  2. - fail:
  3. msg: "fluentd master is not yet supported on atomic hosts"
  4. when: is_atomic
  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: Creates directories
  17. file:
  18. path: "{{ item }}"
  19. state: directory
  20. group: 'td-agent'
  21. owner: 'td-agent'
  22. mode: 0755
  23. with_items: ['/etc/td-agent/config.d']
  24. - name: Add include to td-agent configuration
  25. lineinfile:
  26. dest: '/etc/td-agent/td-agent.conf'
  27. regexp: '^@include config.d'
  28. line: '@include config.d/*.conf'
  29. state: present
  30. - name: install Kubernetes fluentd configuration file
  31. template:
  32. src: kubernetes.conf.j2
  33. dest: /etc/td-agent/config.d/kubernetes.conf
  34. group: 'td-agent'
  35. owner: 'td-agent'
  36. mode: 0444
  37. - name: wait for etcd to start up
  38. wait_for: port=4001 delay=10
  39. when: embedded_etcd | bool
  40. - name: wait for etcd peer to start up
  41. wait_for: port=7001 delay=10
  42. when: embedded_etcd | bool
  43. - name: ensure td-agent is running
  44. service:
  45. name: 'td-agent'
  46. state: started
  47. enabled: yes