bareon/cloud-init-templates/cloud_config_ubuntu.jinja2
Alexei Sheplyakov 8af039fec4 IBP: configure mcollectived so it daemonizes itself
The server.cfg shipped with mcollective package tells mcollectived to
daemonize itself, and the config generated by cloud init tells it to run
in the background (assuming that the init script is responsible for
daemonization). This mismatch breaks PID file: start-stop-daemon forks,
detaches, records its pid, and runs mcollectived which daemonizes again.
As a result the PID recored in the PID file is wrong so subsequent
start/restart/stop action can't find the previously launched process
and starts an extra instance of mcollective.

In order to solve the problem
1) fix the init script (assuming that mcollectived daemonizes itself)
2) generate a proper server.cfg (with daemonize=1 statement)

Related-Bug: #1454741
Merge-After: https://review.fuel-infra.org/6760
Change-Id: I1b9ddc2d8ec790b5a6cb1095e32559cf506c48e7
2015-05-20 16:18:07 +03:00

104 lines
2.7 KiB
Django/Jinja

#cloud-config
resize_rootfs: false
growpart:
mode: false
disable_ec2_metadata: true
disable_root: false
user: root
password: r00tme
chpasswd: { expire: false }
ssh_pwauth: false
ssh_authorized_keys:
{% for key in common.ssh_auth_keys %}
- {{ key }}
{% endfor %}
# set the locale to a given locale
# default: en_US.UTF-8
locale: en_US.UTF-8
timezone: {{ common.timezone }}
hostname: {{ common.hostname }}
fqdn: {{ common.fqdn }}
# add entries to rsyslog configuration
rsyslog:
- filename: 10-log2master.conf
content: |
$template LogToMaster, "<%%PRI%>1 %$NOW%T%TIMESTAMP:8:$%Z %HOSTNAME% %APP-NAME% %PROCID% %MSGID% -%msg%\n"
*.* @{{ common.master_ip }};LogToMaster
# that module's missing in 0.6.3, but existent for >= 0.7.3
write_files:
- content: |
---
url: {{ common.master_url }}
path: /etc/nailgun-agent/config.yaml
- content: target
path: /etc/nailgun_systemtype
mcollective:
conf:
main_collective: mcollective
collectives: mcollective
libdir: /usr/share/mcollective/plugins
logfile: /var/log/mcollective.log
loglevel: debug
daemonize: 1
direct_addressing: 1
ttl: 4294957
securityprovider: psk
plugin.psk: {{ mcollective.pskey }}
{% if mcollective.connector == 'stomp' %}
connector = stomp
plugin.stomp.host: {{ mcollective.host }}
plugin.stomp.port: {{ mcollective.port|default(61613) }}
plugin.stomp.user: {{ mcollective.user }}
plugin.stomp.password: {{ mcollective.password }}
{% else %}
connector: rabbitmq
plugin.rabbitmq.vhost: {{ mcollective.vhost }}
plugin.rabbitmq.pool.size: 1
plugin.rabbitmq.pool.1.host: {{ mcollective.host }}
plugin.rabbitmq.pool.1.port: {{ mcollective.port|default(61613) }}
plugin.rabbitmq.pool.1.user: {{ mcollective.user }}
plugin.rabbitmq.pool.1.password: {{ mcollective.password }}
plugin.rabbitmq.heartbeat_interval: 30
{% endif %}
factsource: yaml
plugin.yaml: /etc/mcollective/facts.yaml
puppet:
conf:
main:
logdir: /var/log/puppet
rundir: /var/run/puppet
ssldir: $vardir/ssl
pluginsync: true
agent:
classfile: $vardir/classes.txt
localconfig: $vardir/localconfig
server: {{ puppet.master }}
report: false
configtimeout: 600
runcmd:
{% if puppet.enable != 1 %}
- /usr/sbin/invoke-rc.d puppet stop
- /usr/sbin/update-rc.d -f puppet remove
{% endif %}
{% if mcollective.enable != 1 %}
- /usr/sbin/invoke-rc.d mcollective stop
- /usr/sbin/update-rc.d -f mcollective remove
{% else %}
- /usr/sbin/update-rc.d mcollective defaults
- service mcollective restart
{% endif %}
- iptables -t filter -F INPUT
- iptables -t filter -F FORWARD
final_message: "YAY! The system is finally up, after $UPTIME seconds"