Only enabled services log files

Only enabled services logs should be added to cron container
and be inclued in cron.json.
This PS adds logic to only copy enabled services cron files.

Change-Id: Id6303a4c77a0230599e11be165489ba46dba65e0
Closes-bug: #1623712
This commit is contained in:
Eduardo Gonzalez 2016-09-16 18:01:47 +02:00
parent 82c1a3d645
commit 3bd180f857
2 changed files with 49 additions and 48 deletions

View File

@ -65,29 +65,30 @@
- name: Copying over cron logrotate config files
template:
src: "cron-logrotate-{{ item }}.conf.j2"
dest: "{{ node_config_directory }}/cron/logrotate/{{ item }}.conf"
src: "cron-logrotate-{{ item.name }}.conf.j2"
dest: "{{ node_config_directory }}/cron/logrotate/{{ item.name }}.conf"
when: item.enabled | bool
with_items:
- "ansible"
- "aodh"
- "barbican"
- "cinder"
- "cloudkitty"
- "glance"
- "global"
- "gnocchi"
- "haproxy"
- "heat"
- "keepalived"
- "keystone"
- "magnum"
- "manila"
- "mariadb"
- "mistral"
- "murano"
- "neutron"
- "nova"
- "rabbitmq"
- "senlin"
- "swift"
- "watcher"
- { name: "ansible", enabled: "yes" }
- { name: "aodh", enabled: "{{ enable_aodh }}" }
- { name: "barbican", enabled: "{{ enable_barbican }}" }
- { name: "cinder", enabled: "{{ enable_cinder }}" }
- { name: "cloudkitty", enabled: "{{ enable_cloudkitty }}" }
- { name: "glance", enabled: "{{ enable_glance }}" }
- { name: "global", enabled: "yes" }
- { name: "gnocchi", enabled: "{{ enable_gnocchi }}" }
- { name: "haproxy", enabled: "{{ enable_haproxy }}" }
- { name: "heat", enabled: "{{ enable_heat }}" }
- { name: "keepalived", enabled: "{{ enable_haproxy }}" }
- { name: "keystone", enabled: "{{ enable_keystone }}" }
- { name: "magnum", enabled: "{{ enable_magnum }}" }
- { name: "manila", enabled: "{{ enable_manila }}" }
- { name: "mariadb", enabled: "{{ enable_mariadb }}" }
- { name: "mistral", enabled: "{{ enable_mistral }}" }
- { name: "murano", enabled: "{{ enable_murano }}" }
- { name: "neutron", enabled: "{{ enable_neutron }}" }
- { name: "nova", enabled: "{{ enable_nova }}" }
- { name: "rabbitmq", enabled: "{{ enable_rabbitmq }}" }
- { name: "senlin", enabled: "{{ enable_senlin }}" }
- { name: "swift", enabled: "{{ enable_swift }}" }
- { name: "watcher", enabled: "{{ enable_watcher }}" }

View File

@ -1,26 +1,26 @@
{% set cron_cmd = 'cron -f' if kolla_base_distro in ['ubuntu', 'debian'] else 'crond -s -n' %}
{% set services = [
"ansible",
"aodh",
"barbican",
"cinder",
"cloudkitty",
"glance",
"gnocchi",
"haproxy",
"heat",
"keepalived",
"keystone",
"magnum",
"manila",
"mariadb",
"mistral",
"murano",
"neutron",
"nova",
"rabbitmq",
"senlin",
"swift"
( 'ansible', 'yes' ),
( 'aodh', enable_aodh ),
( 'barbican', enable_barbican ),
( 'cinder', enable_cinder ),
( 'cloudkitty', enable_cloudkitty ),
( 'glance', enable_glance ),
( 'gnocchi', enable_gnocchi ),
( 'haproxy', enable_haproxy ),
( 'heat', enable_heat ),
( 'keepalived', enable_haproxy ),
( 'keystone', enable_keystone ),
( 'magnum', enable_magnum ),
( 'manila', enable_manila ),
( 'mariadb', enable_mariadb ),
( 'mistral', enable_mistral ),
( 'murano', enable_murano ),
( 'neutron', enable_neutron ),
( 'nova', enable_nova ),
( 'rabbitmq', enable_rabbitmq ),
( 'senlin', enable_senlin ),
( 'swift', enable_swift )
] %}
{
"command": "{{ cron_cmd }}",
@ -31,13 +31,13 @@
"owner": "root",
"perm": "0644"
},
{% for service in services %}
{% for service, enabled in services if enabled | bool %}
{
"source": "{{ container_config_directory }}/logrotate/{{ service }}.conf",
"dest": "/etc/logrotate.d/{{ service }}.conf",
"owner": "root",
"perm": "0644"
}{% if not loop.last %},{% endif %}
}{{ ',' if not loop.last else '' }}
{% endfor %}
]