Add an os-collect-config element.

Change-Id: I8b27678bb8495d10b355aa7f6370a4f86f6c957d
This commit is contained in:
Clint Byrum 2013-07-18 10:47:16 -07:00
parent 3495a2352b
commit 4512af045d
5 changed files with 102 additions and 0 deletions

View File

@ -0,0 +1,32 @@
Setup os-collect-config to run as a system service. By default it will
run os-refresh-config on any changes.
Configuration
-------------
Heat Metadata can be used to configure os-collect-config:
os-collect-config:
command: os-refresh-config
cachedir: /var/run/os-collect-config
collectors: heat_local,ec2,cfn
polling_interval: 300
cfn:
metadata_url: http://foo:8000/v1
heat_metadata_hint: /var/lib/heat-cfntools/cfn-metadata-server
stack_name: required-stack-name
access_key_id: abcdefghijklmnop091234
secret_access_key: fffeeeeddddccccaaaa99999
path: ThisResource.Metadata
ec2:
metadata_url: http://169.254.169.254/latest/meta-data
heat_local:
path: /var/lib/heat-cfntools/cfn-init-data
Note that `metadata_url` is optional, as it should be determined by the
file `heat_metadata_hint` refers to. This file is injected by Heat via
cloud-init at first boot. Those two parameters are the only optional
parameters. All of the others are required for the cfn data source
to function.
`ec2` and `heat_local` do not require any configuration to work.

View File

@ -0,0 +1 @@
source-repositories

View File

@ -0,0 +1,42 @@
#!/bin/bash
set -eux
install-packages python-pip build-essential libxslt-dev libxml2-dev python-dev
pip install /opt/stack/os-collect-config
# Upstart
if [ -d /etc/init ] ; then
cat > /etc/init/os-collect-config.conf <<eof
start on runlevel [2345]
stop on runlevel [016]
respawn
exec os-collect-config
eof
# Systemd
elif [ -d /lib/systemd/system ] ; then
cat > /lib/systemd/system/os-collect-config.service <<eof
[Unit]
Description=Collect metadata and run hook commands.
After=cloud-final.service
Before=crond.service
[Service]
ExecStart=/bin/os-collect-config
Restart=on-failure
[Install]
WantedBy=multi-user.target
eof
# Make systemd take notice of it
systemctl daemon-reload
# Enable the service
systemctl enable os-collect-config.service
else
echo Only systems with systemd or upstart are supported.
exit 1
fi

View File

@ -0,0 +1,26 @@
[DEFAULT]
{{^os-collect-config.command}}
command = os-refresh-config
{{/os-collect-config.command}}
{{#os-collect-config}}
{{#command}}
command = {{command}}
{{/command}}
{{#polling_interval}}
polling_interval = {{polling_interval}}
{{/polling_interval}}
{{#cachedir}}
cachedir = {{cachedir}}
{{/cachedir}}
{{#collectors}}
collectors = {{collectors}}
{{/collectors}}
{{#cfn}}
[cfn]
metadata_url = {{metadata_url}}
stack_name = {{stack_name}}
secret_access_key = {{secret_access_key}}
access_key_id = {{access_key_id}}
{{/cfn}}
{{/os-collect-config}}

View File

@ -0,0 +1 @@
os-collect-config git /opt/stack/os-collect-config https://github.com/stackforge/os-collect-config.git