cloud-init with puppet doesn't work in trusty

Bug #1355909 reported by Daniel Roschka
48
This bug affects 9 people
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Unassigned

Bug Description

When running cloud-init with puppet configuration in the user-data a bunch of problems occurs when cloud-init tries install and start puppet:

Problem 1: Enabling of puppet fails
cloud-init isn't able to enable the puppet service, because non of the options in _autostart_puppet in cc_puppet.py is valid (see: https://github.com/number5/cloud-init/blob/master/cloudinit/config/cc_puppet.py#L35-L48). For Ubuntu 12.04 LTS /etc/default/puppet was created when installing puppet which caused that issue not to occur there.

Problem 2: (Re)Starting of puppet fails
I worked around Problem 1, by including the following bootcmd into the userdata:
bootcmd:
 - echo START=yes > /etc/default/puppet
Even then puppet doesn't get installed correctly, because when cloud-init tries to start puppet (by using "service puppet start") puppet is already running (because it has been started during the installation) and "service puppet start" is returning 1 as return code, causing cloud-init to fail.

Problem 3: puppet is still not enabled
Manually restarting puppet works, but puppet won't do anything useful, because:
Aug 12 15:41:39 ip-10-128-24-151 puppet-agent[26304]: Skipping run of Puppet configuration client; administratively disabled (Reason: 'Disabled by default on new installations');
Aug 12 15:41:39 ip-10-128-24-151 puppet-agent[26304]: Use 'puppet agent --enable' to re-enable.

Please fix those issues to make cloud-init with setup of puppet working again.

Revision history for this message
Scott Moser (smoser) wrote :

Hi, thanks for taking the tiem to report this bug.
It seems to me that if we just change the 'service puppet start' to 'service puppet restart', then we'd be good.

for Problem 1:
 i think we'd see a log message of "Sorry we do not know how to enable..." but that the module would go on.

For Problem 2:
 In my quick test, a 'apt-get install puppet' did in fact result in running puppet:
 $ sudo service puppet status
 * agent is running

Problem 3:
 if we just run sudo service puppet restart, then it will actually restart it. And since it is sysvinit script, restart means "start if not running". In Upstart world, 'restart' means 'restart only if currently running'.

Can you try just adding a bootcmd like this and see if it fixes the problem:
 sed -i "s,'start','restart'," /usr/lib/python2.7/dist-packages/cloudinit/config/cc_puppet.py

Changed in cloud-init:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Daniel Roschka (v-daniel-d) wrote :

With the following two bootcmds restarting puppet by cloud-init works (if "apt_upgrade: true" isn't enabled, because that would cause an overwriting of the changes in cc_puppet.py):

bootcmd:
 - echo START=yes > /etc/default/puppet
 - sed -i "s/'start'/'restart'/" /usr/lib/python2.7/dist-packages/cloudinit/config/cc_puppet.py

But: Puppet is still disabled.

Aug 14 12:52:39 ip-10-128-26-184 puppet-agent[2316]: Starting Puppet client version 3.4.3
Aug 14 12:52:39 ip-10-128-26-184 puppet-agent[2316]: Skipping run of Puppet configuration client; administratively disabled (Reason: 'Disabled by default on new installations');
Aug 14 12:52:39 ip-10-128-26-184 puppet-agent[2316]: Use 'puppet agent --enable' to re-enable.

I added a patch which should solve the enabling problem. A proper solution inside of cloud-init for the restart would be appreciated too.

Revision history for this message
Daniel Roschka (v-daniel-d) wrote :

Seems like a patch for the restart problematic has been already created as part of https://bugs.launchpad.net/cloud-init/+bug/1090218

Revision history for this message
Daniel Roschka (v-daniel-d) wrote :

Any update on this?
Right now this is preventing proper automatic deployment of machines managed by puppet using cloud-init in Ubuntu 14.04 LTS.

Revision history for this message
Andreas Rütten (aruetten) wrote :

Is there any chance to get a fix into LTS 14.04?

This bug prevents us from switching our system from 12.04 to 14.04

Revision history for this message
D.Schäfer (trash4you) wrote :

Any update on this?

Revision history for this message
Graham Leggett (minfrin-y) wrote :

This bug breaks things for us too on 14.04 LTS.

Revision history for this message
KaZeR (kazer) wrote :

I'm also impacted.

Revision history for this message
Stefan Friesel (stefan-friesel) wrote :

Also breaks on 16.04 LTS

Revision history for this message
Jon Proulx (jproulx) wrote :

Can't believe this is still here why not just add a call to "puppet agent --enable"?

my kludge around (also ubuntu 16.04)

runcmd:
  - [ puppet, agent, --enable ]
  - [ puppet, agent, -t ]

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers