You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB

  1. ---
  2. - hosts: localhost
  3. become: true
  4. gather_facts: no
  5. vars:
  6. log_path: /var/log/ansible/
  7. conf_file: /etc/ansible/ansible.cfg
  8. human_readable_plugin: false
  9. callback_plugin_path: /usr/share/ansible/plugins/callback
  10. tasks:
  11. - name: LOGS | ensure log path
  12. file: path="{{log_path}}" state=directory owner={{ansible_ssh_user}}
  13. - name: LOGS | ensure plugin path
  14. file: path="{{callback_plugin_path}}" state=directory owner={{ansible_ssh_user}}
  15. when: human_readable_plugin
  16. - name: LOGS | get plugin
  17. git: repo=https://gist.github.com/cd706de198c85a8255f6.git dest=/tmp/cd706de198c85a8255f6
  18. when: human_readable_plugin
  19. - name: LOGS | install plugin
  20. copy: src=/tmp/cd706de198c85a8255f6/human_log.py dest="{{callback_plugin_path}}"
  21. when: human_readable_plugin
  22. - name: LOGS | config
  23. lineinfile:
  24. line: "log_path={{log_path}}/ansible.log"
  25. regexp: "^#log_path|^log_path"
  26. dest: "{{conf_file}}"
  27. - name: LOGS | callback plugin
  28. lineinfile:
  29. line: "callback_plugins={{callback_plugin_path}}"
  30. regexp: "^#callback_plugins|^callback_plugins"
  31. dest: "{{conf_file}}"
  32. when: human_readable_plugin