logstash_conf.yml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ---
  2. - name: Add SSH authorized key for synchronize Moudle
  3. authorized_key:
  4. user: root
  5. state: present
  6. key: "{{ lookup('file', '/root/.ssh/id_rsa.pub') }}"
  7. tags: logstash_conf
  8. - name: Sync Logstash Config Files
  9. synchronize: # need input password in command line if ssh key is none.
  10. src: "{{ item }}"
  11. dest: /opt/logstash/logstash-6.0.0
  12. delete: yes
  13. with_items:
  14. - "config"
  15. - "patterns"
  16. tags: logstash_conf, logstash_stop
  17. - name: Stop All Flume Agent
  18. shell: ps -ef |grep [l]ogstash |grep nginx_access.conf |awk '{print $2}'|xargs kill; echo "Stop All Agent Done."
  19. tags: logstash_conf, logstash_stop
  20. #- name: Clean Local Data
  21. # file:
  22. # path: /data/logstash/data
  23. # state: absent
  24. # tags: logstash_stop, logstash_conf
  25. - name: Start All Logstash Agent
  26. shell: "{{ item }}"
  27. with_items:
  28. - "nohup bin/logstash -f config/nginx_access.conf --config.reload.automatic >/dev/null 2>&1 &"
  29. # - "nohup bin/logstash-ng agent --conf conf --conf-file conf/backend.log.conf --name agent05 -Dlogstash.root.logger=INFO,console >/dev/null 2>&1 &"
  30. args:
  31. chdir: /opt/logstash/logstash-6.0.0
  32. tags: logstash_conf