aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Gonzalez <dabarren@gmail.com>2016-09-16 18:01:47 +0200
committerEduardo Gonzalez <dabarren@gmail.com>2016-09-18 13:21:58 +0200
commit3bd180f857bdab8edf1ea0c98934eb817df22f73 (patch)
tree8fa7ab75b611543c5c3200b959a72deb5dbe2cf1
parent82c1a3d645c051441715e9e598da07ce94224923 (diff)
downloadkolla-3bd180f857bdab8edf1ea0c98934eb817df22f73.tar.gz
kolla-3bd180f857bdab8edf1ea0c98934eb817df22f73.zip
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
-rw-r--r--ansible/roles/common/tasks/config.yml51
-rw-r--r--ansible/roles/common/templates/cron.json.j246
2 files changed, 49 insertions, 48 deletions
diff --git a/ansible/roles/common/tasks/config.yml b/ansible/roles/common/tasks/config.yml
index f28aced81..426760502 100644
--- a/ansible/roles/common/tasks/config.yml
+++ b/ansible/roles/common/tasks/config.yml
@@ -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 }}" }
diff --git a/ansible/roles/common/templates/cron.json.j2 b/ansible/roles/common/templates/cron.json.j2
index 26b8a47eb..85d0a1a4f 100644
--- a/ansible/roles/common/templates/cron.json.j2
+++ b/ansible/roles/common/templates/cron.json.j2
@@ -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 %}
]