Commit fcae174d authored by Alain Takoudjou's avatar Alain Takoudjou

Ansible: add logrotate role

parent 9a2be62c
......@@ -25,4 +25,15 @@
- { role: vm-disks, vd_disk: s, data_n: 12 }
- { role: vm-disks, vd_disk: t, data_n: 12 }
- { role: vm-disks, vd_disk: u, data_n: 12 }
- role: logrotate
logrotate_scripts:
- name: vm-bootstrap
path: /var/log/vm-bootstrap.log
options:
- weekly
- compress
- rotate 5
- notifempty
- create
- dateext
---
- name: Install logrotate
action: "{{ansible_pkg_mgr}} pkg=logrotate state=present"
- name: Configure logrotate.d scripts
template:
src: logrotate.d.j2
dest: /etc/logrotate.d/{{ item.name }}
with_items: logrotate_scripts
when: logrotate_scripts is defined
# {{ ansible_managed }}
"{{ item.path }}" {
{% if item.options is defined -%}
{% for option in item.options -%}
{{ option }}
{% endfor -%}
{% endif %}
{%- if item.scripts is defined -%}
{%- for name, script in item.scripts.iteritems() -%}
{{ name }}
{{ script }}
endscript
{% endfor -%}
{% endif -%}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment