From a44f2e6767a680fb6f39ad03a1e3ad7c895ec0ee Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 20 Dec 2017 10:44:18 +1100 Subject: [PATCH] Run expand-groups.sh occasionally under cron We only run expand-groups.sh during launch-node -- which makes sense for additions as we don't have hosts appearing that don't come via that path. However nothing really runs it on removal of hosts, meaning /etc/ansible/hosts/generated-groups can contain old entries until the next time a new host is launched. Simply run it once a day to keep it fresh. [1] http://git.openstack.org/cgit/openstack-infra/system-config/tree/launch/launch-node.py#n172 Change-Id: Ia112082df33b5ebf465f7d5a23685cc3e28b0551 --- .../manifests/puppetmaster.pp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/openstack_project/manifests/puppetmaster.pp b/modules/openstack_project/manifests/puppetmaster.pp index aad32cea0a..a23f8fd382 100644 --- a/modules/openstack_project/manifests/puppetmaster.pp +++ b/modules/openstack_project/manifests/puppetmaster.pp @@ -352,6 +352,29 @@ class openstack_project::puppetmaster ( source => 'puppet:///modules/openstack_project/puppetmaster/expand-groups.sh', notify => Exec['expand_groups'], } + + cron { 'expandgroups': + user => 'root', + minute => 0, + hour => 4, + command => '/usr/local/bin/expand-groups.sh >> /var/log/expand_groups.log 2>&1', + environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin', + } + + logrotate::file { 'expandgroups': + ensure => present, + log => '/var/log/expand_groups.log', + options => ['compress', + 'copytruncate', + 'delaycompress', + 'missingok', + 'rotate 7', + 'daily', + 'notifempty', + ], + require => Cron['expandgroups'], + } + # Temporarily pin paho-mqtt to 1.2.3 since 1.3.0 won't support TLS on # Trusty's Python 2.7. if $enable_mqtt {