<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>ConfigurationManagement</title><revhistory><revision><revnumber>28</revnumber><date>2023-10-13 13:57:26</date><authorinitials>ClintonEbadi</authorinitials><revremark>installed sysctl module to manage keyring size</revremark></revision><revision><revnumber>27</revnumber><date>2022-03-05 20:20:07</date><authorinitials>ClintonEbadi</authorinitials><revremark>minor fixes to procedure for creating admin env</revremark></revision><revision><revnumber>26</revnumber><date>2021-04-30 02:49:50</date><authorinitials>ClintonEbadi</authorinitials><revremark>move admin puppet envs to /srv</revremark></revision><revision><revnumber>25</revnumber><date>2020-12-02 03:41:09</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>24</revnumber><date>2020-12-02 03:11:22</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>23</revnumber><date>2020-12-02 03:05:35</date><authorinitials>ClintonEbadi</authorinitials><revremark>new puppet modules for jitsi meet</revremark></revision><revision><revnumber>22</revnumber><date>2019-04-20 21:19:57</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>21</revnumber><date>2019-04-20 21:02:38</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>20</revnumber><date>2019-04-20 20:51:17</date><authorinitials>ClintonEbadi</authorinitials><revremark>cleaned up puppet deploys</revremark></revision><revision><revnumber>19</revnumber><date>2019-04-20 20:43:49</date><authorinitials>ClintonEbadi</authorinitials><revremark>having second thoughts about firewall_multi</revremark></revision><revision><revnumber>18</revnumber><date>2018-11-11 04:09:25</date><authorinitials>ClintonEbadi</authorinitials><revremark>root cron jobs must set MAILTO</revremark></revision><revision><revnumber>17</revnumber><date>2018-10-26 01:51:06</date><authorinitials>ClintonEbadi</authorinitials><revremark>installed puppetlabs-mailalias_core module</revremark></revision><revision><revnumber>16</revnumber><date>2018-10-16 04:00:28</date><authorinitials>ClintonEbadi</authorinitials><revremark>we're using puppet 6 now</revremark></revision><revision><revnumber>15</revnumber><date>2018-10-14 00:42:14</date><authorinitials>ClintonEbadi</authorinitials><revremark>installed puppetlabs-tagmail module</revremark></revision><revision><revnumber>14</revnumber><date>2018-10-12 21:12:22</date><authorinitials>ClintonEbadi</authorinitials><revremark>installed puppetlabs-mysql module</revremark></revision><revision><revnumber>13</revnumber><date>2018-10-11 23:23:24</date><authorinitials>ClintonEbadi</authorinitials><revremark>installed puppetlabs-stunnel module</revremark></revision><revision><revnumber>12</revnumber><date>2018-07-08 03:38:33</date><authorinitials>ClintonEbadi</authorinitials><revremark>installed puppet-posix_acl</revremark></revision><revision><revnumber>11</revnumber><date>2018-07-07 02:36:30</date><authorinitials>ClintonEbadi</authorinitials><revremark>installed puppet-logrotate module</revremark></revision><revision><revnumber>10</revnumber><date>2018-07-05 02:23:42</date><authorinitials>ClintonEbadi</authorinitials><revremark>installed puppetlabs-apache module</revremark></revision><revision><revnumber>9</revnumber><date>2018-05-05 22:26:39</date><authorinitials>ClintonEbadi</authorinitials><revremark>scratch notes on personal puppet envs</revremark></revision><revision><revnumber>8</revnumber><date>2018-04-24 02:27:17</date><authorinitials>ClintonEbadi</authorinitials><revremark>puppet module camptocamp-systemd</revremark></revision><revision><revnumber>7</revnumber><date>2018-04-22 02:15:45</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>6</revnumber><date>2018-04-22 02:12:42</date><authorinitials>ClintonEbadi</authorinitials><revremark>start date for config packages</revremark></revision><revision><revnumber>5</revnumber><date>2018-04-22 02:11:42</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>4</revnumber><date>2018-04-22 02:11:21</date><authorinitials>ClintonEbadi</authorinitials><revremark>notes on difficulties encountered with config packages</revremark></revision><revision><revnumber>3</revnumber><date>2018-04-22 02:04:39</date><authorinitials>ClintonEbadi</authorinitials><revremark>initial notes on new puppet managed setup</revremark></revision><revision><revnumber>2</revnumber><date>2013-05-30 17:31:07</date><authorinitials>ClintonEbadi</authorinitials><revremark>I thought I documented this, try and get some kind of start now</revremark></revision><revision><revnumber>1</revnumber><date>2013-01-05 06:27:37</date><authorinitials>ClintonEbadi</authorinitials><revremark>basic stub</revremark></revision></revhistory></articleinfo><section><title>Puppet</title><para>As of 2018, HCoop is using Puppet to manage system configuration. </para><section><title>puppetserver</title><itemizedlist><listitem><para>Hosted on <ulink url="https://wiki.hcoop.net/ConfigurationManagement/ServerGibran#">ServerGibran</ulink> </para></listitem><listitem><para>Installed <ulink url="https://apt.puppetlabs.com/puppet6-release-stretch.deb"/> manually </para></listitem><listitem><para>Packages: puppetserver, puppet-agent </para></listitem></itemizedlist><para>Puppet git structure (different repos for each): /etc/puppetlabs/puppet, /etc/puppetlabs/code/environments/production (excludes modules), /etc/puppetlabs/code/environments/production/modules/hcoop,  /etc/puppetlabs/code/environments/production/modules/hcoop_private. Subject to change. </para><para>Git repos structure and tracking of installed modules will be revisited once we need to set up multiple environments. For now, <code>/etc/puppetlabs/code/environments/production/modules/hcoop</code> is where all of our code aside from node definitions lives. <code>/etc/puppetlabs/code/environments/production/modules/hcoop_private</code> is for private data (krb5 host keys, ssl keys, etc.) that needs to be managed by Puppet. Ideally we would use something like <ulink url="https://www.eyrie.org/~eagle/software/wallet/">wallet</ulink> for this instead. hcoop_private contains only virtual references to files tagged appropriately so they can be realized on individual servers. </para><para>Puppet module structure: </para><itemizedlist><listitem><para>hcoop </para><itemizedlist><listitem><para>server </para><itemizedlist><listitem><para>$server (e.g. gibran) </para></listitem></itemizedlist></listitem><listitem><para>service </para><itemizedlist><listitem><para>openafs-client </para></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist><section><title>puppetdb</title><para>install guide is weird </para><screen><![CDATA[ puppet resource package puppetdb ensure=latest
 puppet resource package puppetdb-termini ensure=latest
 puppet module install puppetlabs-puppetdb]]></screen></section></section><section><title>Installed Modules</title><para>Please Update when installing a new module on the puppetserver. </para><itemizedlist><listitem><para>puppetlabs-firewall </para></listitem><listitem><para>puppetlabs-puppetdb </para></listitem><listitem><para>alexharvey-firewall_multi (says incompatible, but works... enough). </para></listitem><listitem><para>stm-resolv_conf </para></listitem><listitem><para>ccin2p3-mit_krb5 </para></listitem><listitem><para>stm-debconf </para></listitem><listitem><para>saz-sudo </para></listitem><listitem><para>herculesteam-augeasproviders_pam </para></listitem><listitem><para>herculesteam-augeasproviders_core </para></listitem><listitem><para>saz-timezone </para></listitem><listitem><para>dalen-dnsquery </para></listitem><listitem><para>camptocamp-systemd </para></listitem><listitem><para>puppetlabs-apache </para></listitem><listitem><para>puppet-logrotate </para></listitem><listitem><para>puppetlabs-stunnel </para></listitem><listitem><para>puppetlabs-mysql </para></listitem><listitem><para>puppetlabs-tagmail </para></listitem><listitem><para>puppetlabs-mailalias_core </para></listitem><listitem><para>smash-jitsimeet </para></listitem><listitem><para><ulink url="https://github.com/voxpupuli/puppet-prosody.git">puppet-prosody</ulink> (for smash-jitsimeet) </para></listitem><listitem><para>puppet-nginx (for smash-jitsimeet) </para></listitem><listitem><para>thias-sysctl </para></listitem></itemizedlist><section><title>Specially Installed Module</title><para>These are not in puppet forge, but seemed useful enough to deal with manually.  </para><itemizedlist><listitem><para>puppet-posix_acl from <ulink url="https://github.com/voxpupuli/puppet-posix_acl"/> </para></listitem></itemizedlist></section></section><section><title>Style Guidelines</title><para>Ideas for keeping consistency among admins. Work in progress. </para><itemizedlist><listitem><para>Use firewall_multi for all rules unless it really is ipv4 or ipv6 only, provider is set in defaults and will keep ipv4 and ipv6 firewall in sync </para><itemizedlist><listitem><para>In retrospect this was probably bad and we might want to instead create our own defined type to wrap firewall_multi </para></listitem></itemizedlist></listitem><listitem><para>Should pass puppet-lint (enforce using git hook) / respect <ulink url="https://puppet.com/docs/puppet/5.5/style_guide.html"/> </para></listitem><listitem><para>Inheritance is discouraged? Avoiding it for now </para></listitem><listitem><para>Files controlled by puppet have comment &quot;This file is managed by Puppet. DO NOT EDIT.&quot; somewhere near the top </para></listitem><listitem><para>Some structure to firewall rule numbers </para><itemizedlist><listitem><para>Under 100 for core system things that need to go near the beginning </para></listitem><listitem><para>Over 900 for core system things that need to go near the end (e.g. jumping to fwtool output chains) </para></listitem></itemizedlist></listitem><listitem><para>Any root crontabs should have <code>environment =&gt; 'MAILTO=log+SERVICE@hcoop.net'</code> (where <code>SERVICE</code> is the service the cron is related to). This ensures that mail won't go to the wrong address if another job sets <code>MAILTO</code> earlier in the crontab. </para></listitem></itemizedlist></section><section><title>Deploying Changes</title><para>A bare git repo of the <code>hcoop</code> puppet module is stored in /afs/hcoop.net/user/h/hc/hcoop/private/hcoop-puppet-module.git. Only the <code>hcoop</code> user and members of afs <code>system:administrators</code> have access currently. </para><para>A cron runs every few minutes to pull changes and will send an email to all admins if any changes were made. </para><para>Each admin has their own personal environment. To deploy, push to the default origin of <code>/afs/hcoop.net/user/h/hc/hcoop/private/hcoop-puppet-module.git</code>, and wait for the cron to run (if changes need to be applied sooner, changes can be pulled into the production environment manually). </para></section><section><title>Personal Environments</title><para>Each admin will have a <ulink url="https://puppet.com/docs/puppet/5.5/environments_about.html">puppet environment</ulink> where changes should be made and tested with <code>puppet agent --test  --noop --environment $user</code>. Before testing with your environment, even using <code>--noop</code>, make sure you have pulled in changes from the central repo. Even <code>--noop</code> tests cause puppetdb rules to be created/deleted, and there is no separate environment support in puppetdb so running with a stale environment could trigger unexpected side effects (lasting until the agent automatically runs again and overwrites any spurious facts with the correct ones from production). </para><para>Setting up: </para><para>We store personal environments in <code>/srv/puppet/environments</code> so that etckeeper does not persistently alert (causing it to be ignored) if an admin has uncommitted work in their git repo. </para><screen><![CDATA[mkdir -p /srv/puppet/environments/USER_admin/{modules,manifests}
ln -s /srv/puppet/environments/USER_admin/ /etc/puppetlabs/code/environments/USER_admin]]></screen><para>In <code>/etc/puppetlabs/code/environments/USER_admin/</code>: </para><para>set up <code>environment.conf</code> (can be copied from another user, it's identical for all user environments) </para><screen><![CDATA[    modulepath = ./modules:$basemodulepath:../production/modules
    manifest = ../production/manifests]]></screen><para>check out modules/hcoop: </para><screen><![CDATA[    cd modules && git clone /afs/hcoop.net/user/h/hc/hcoop/private/hcoop-puppet-module.git hcoop
    cd hcoop && git submodule init
    chown USER_admin: -R /etc/puppetlabs/code/environments/USER_admin]]></screen><para>To checkout, you will need to have afs tokens for a member of <code>system:administrators</code>. </para><para>problems: </para><itemizedlist><listitem><para>no tracking of site.pp or top level hiera files </para></listitem></itemizedlist></section></section><section><title>Config Packages</title><para>From 2013 until 2018 we were using <ulink url="http://debathena.mit.edu/config-packages/">config-package-dev</ulink> to manage the configuration of shared services.  They proved to be cumbersome to maintain and were abandoned for Puppet. </para><para>The following is for historical reference only. </para><section><title>Rationale</title><para>Using config-package-dev has several advantages for HCoop: </para><itemizedlist><listitem><para>They can be used to <ulink url="https://wiki.hcoop.net/ConfigurationManagement/AutomatedSystemInstall#">automate installation</ulink> </para></listitem><listitem><para>Our changes to config are kept in an executable format </para></listitem><listitem><para>Basic Debian packaging is straightforward to pick up </para></listitem><listitem><para>Distribution of configuration occurs through the same channel as our general software updates </para></listitem><listitem><para>Everyone is forced to formalize their changes rather than leaving a trail of undocumented changes </para></listitem></itemizedlist><section><title>Post-Mortem</title><para>However, we failed to realize many of these benefits in the end: </para><itemizedlist><listitem><para>Basic Debian packaging was not quite as straightforward to pick up or remember as it seemed initially </para><itemizedlist><listitem><para>An extra entry barrier for new admins by using a config management system not widely used by others </para></listitem></itemizedlist></listitem><listitem><para>Packages were cumbersome to update, and resulted in a trail of underdocumented and unpackaged changes </para></listitem><listitem><para>Packages were cumbersome to port between Debian releases </para></listitem><listitem><para>Distributing configuration with apt was time consuming </para><itemizedlist><listitem><para>Packages must be released, built, uploaded, and installed which could take upward of an hour, compared to Puppet that runs an agent and fetches new updates within minutes </para></listitem></itemizedlist></listitem></itemizedlist><para>The benefit of automated system installs was realized. </para></section></section><section><title>Current Config Packages</title><para>We are managing our configuration packages in git, at <code>/afs/hcoop.net/user/h/hc/hcoop/.hcoop-git/debian</code>, or you can view the <ulink url="http://git.hcoop.net/?a=project_list&amp;pf=hcoop%2Fdebian&amp;s=-config">list of configuration packages</ulink> using gitweb. </para></section><section><title>Creating a Config Package</title><para>See <ulink url="https://wiki.hcoop.net/ConfigurationManagement/DebianPackaging#Creating_a_Configuration_Package">DebianPackaging#Creating_a_Configuration_Package</ulink> for the low-level details of creating a config package and our general packaging workflow with git-buildpackage. </para><para>The <ulink url="http://debathena.mit.edu/config-packages/">Debathena documentation</ulink> describes the new primitives. Primarily, config packages will consist of files installed with <code>dh_install</code>, a few diversions, and some transformations. Use what makes sense: <code>dh_installcron</code> et al are your friends. The <ulink url="http://git.hcoop.net/?p=hcoop/debian/hcoop-apache2-config.git;a=summary">hcoop-apache2-config</ulink> package is a good example. </para></section><section><title>Services Changed But Unpackaged</title><itemizedlist><listitem><para>php5 config (changed a few variables, disabled some suhosin stuff at least). </para></listitem></itemizedlist><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="https://wiki.hcoop.net/ConfigurationManagement/CategorySystemAdministration#">CategorySystemAdministration</ulink> </para></section></section></article>