Add check to deploy config if log exists

Role will now test if a log exist (and hence the application exists
    on the host before writing a logrotate config to the server.
This commit is contained in:
Serge van Ginderachter 2020-09-17 22:23:16 +02:00
parent b0e5245e4e
commit 82d5bd7d16
No known key found for this signature in database
GPG key ID: 3148E9B9232D65E5
5 changed files with 90 additions and 32 deletions

View file

@ -1,37 +1,35 @@
{{ ansible_managed | comment }}
{% for definition in item.definitions %}
{{ definition.logs | join(" ") }} {
{% for option in definition.options %}
{{ item.logs | join(" ") }} {
{% for option in item.options %}
{{ option }}
{% endfor %}
{% if definition.postrotate|default([]) %}
{% if item.postrotate|default([]) %}
postrotate
{% for line in definition.postrotate %}
{% for line in item.postrotate %}
{{ line }}
{% endfor %}
endscript
{% endif %}
{% if definition.preremove|default([]) %}
{% if item.preremove|default([]) %}
preremove
{% for line in definition.preremove %}
{% for line in item.preremove %}
{{ line }}
{% endfor %}
endscript
{% endif %}
{% if definition.lastaction|default([]) %}
{% if item.lastaction|default([]) %}
lastaction
{% for line in definition.lastaction %}
{% for line in item.lastaction %}
{{ line }}
{% endfor %}
endscript
{% endif %}
{% if definition.firstaction|default([]) %}
{% if item.firstaction|default([]) %}
firstaction
{% for line in definition.firstaction %}
{% for line in item.firstaction %}
{{ line }}
{% endfor %}
endscript
{% endif %}
}
{% endfor %}