example42 / psick

Puppet Systems Infrastructure Construction Kit: The control-repo

Home Page:http://www.example42.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FOSS puppet master install - file clash

antgel opened this issue · comments

I started again with a vanilla Ubuntu 16.04 instance, and latest psick production branch.

According to the docs, we clone psick to /etc/puppetlabs/code/environments/production:

mkdir -p /etc/puppetlabs/code/environments
cd /etc/puppetlabs/code/environments
git clone https://github.com/example42/psick.git production

However, this causes a problem, as when we install the puppet-agent package via bin/puppet_install.sh (the exact line being apt-get install puppet-agent -y), it fails because environment.conf is already in /etc/puppetlabs/code/environments/production/environment.conf following the git clone:

### Installing Puppet and its dependencies ###
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  puppet-agent
0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded.
Need to get 0 B/16.4 MB of archives.
After this operation, 92.0 MB of additional disk space will be used.
Selecting previously unselected package puppet-agent.
(Reading database ... 53588 files and directories currently installed.)
Preparing to unpack .../puppet-agent_1.10.8-1xenial_amd64.deb ...
Unpacking puppet-agent (1.10.8-1xenial) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Setting up puppet-agent (1.10.8-1xenial) ...

Configuration file '/etc/puppetlabs/code/environments/production/environment.conf'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** environment.conf (Y/I/N/O/D/Z) [default=N] ? 

We can confirm this:

ubuntu@puppet:~$ dpkg -L puppet-agent |grep "environment\.conf"
/etc/puppetlabs/code/environments/production/environment.conf

I guess that the -y on line 79 of bin/puppet_install.sh (apt-get install puppet-agent -y) is meant to handle this, but either 1) it's not working as intended or 2) I'm tired and trying to do something very wrong.

Plus, shouldn't /etc/puppetlabs/code/environments be managed by r10k anyway, instead of having psick cloned into it?

Please, in general, do your tests using the integration branch of psick control-repo, there is where we have the latest code.

Documenttion here has to be cleaned up, in short:
if you install puppet agent before cloning the control repo, it should be enough to run:

bin/puppet_deploy_controlrepo.sh

The scripts does the commands mentioned in the docs and eventually move the existing default production environment.
If you run that command before installing puppet then you actually get the error, I suppose the -y options which assumes yes to all prompts, in this case needs the default no.

As for the last question the ansuwer is yes, if you use r10k environments should not be populated, but we need the code to be deployed somewhere to kickstart the puppetserver configuration, and in any case, once configured, r10k should be able to remove the existing production branch.

For a setup based on a git clone on environments production give a look to:
https://github.com/example42/psick/blob/integration/hieradata/nodes/puppet.foss.psick.io.yaml

at the moment I prefer to avoid to use the r10k option since the r10k module has too many prerequisites, but that's also a possible way.

Finally, note that only recently I started to work on the foss puppetserver setup, there are still some rough edges.

@antgel This should be fixed now, in the production branch.

Tested and working, thanks!