Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. ## How to get Puppet 6.6 up and running on a Raspberry Pi running Raspbian Buster.
  2. These instructions were tested on a Pi 4 with the latest version of Raspbian (Raspbian GNU/Linux 10 (buster)).
  3.  
  4. This guide assumes basic competency with the command line. It also assumes you have a functional puppet master set up with the hostname of `puppet`. If you can `ping puppet`, you should be all set. Also note that I am just getting into puppet and am not a master of this domain. There may be errors, and there is probably a better way to do this, but in my searching, I was unable to locate a good set of instructions to get this working, so here we are. Feel free to contact me for corrections.
  5.  
  6. You can either switch to root `sudo -i`, or prepend all the following commands with `sudo`.
  7.  
  8. #### Update first
  9. ```
  10. apt update
  11. apt upgrade -y
  12. ```
  13.  
  14. #### Install ruby
  15. ```
  16. apt install ruby-full
  17. ```
  18.  
  19. #### Install Puppet
  20. ```
  21. gem install puppet
  22. ```
  23.  
  24. #### The gem install does less than a normal packaged install of puppet, so we need to fit some things into place.
  25. ```
  26. mkdir -p /etc/puppetlabs/puppet/
  27. touch /etc/puppetlabs/puppet/puppet.conf
  28. ```
  29.  
  30. #### Use whatever your puppetmaster hostname is here if it differs from **'puppet'**.
  31. ```
  32. puppet config set server 'puppet' --section main
  33. ```
  34.  
  35. #### Ensure the the proper user is present to run puppet.
  36. ```
  37. puppet resource group puppet ensure=present
  38. puppet resource user puppet ensure=present gid=puppet shell='/bin/false'
  39. ```
  40.  
  41. #### More structure
  42. ```
  43. mkdir -p /etc/puppetlabs/code/environments/production/modules/
  44. mkdir -p /etc/puppetlabs/code/environments/production/manifests/
  45. ```
  46. #### We need to manually create a few files, including the systemd init file.
  47. ```
  48. cat << EOF > /etc/default/puppet
  49. # You may specify parameters to the puppet client here
  50. #PUPPET_EXTRA_OPTS=--waitforcert=500
  51. EOF
  52. ```
  53. ```
  54. cat << EOF > /lib/systemd/system/puppet.service
  55. #
  56. # Local settings can be configured without being overwritten by package upgrades, for example
  57. # if you want to increase puppet open-files-limit to 10000,
  58. # you need to increase systemd's LimitNOFILE setting, so create a file named
  59. # "/etc/systemd/system/puppet.service.d/limits.conf" containing:
  60. # [Service]
  61. # LimitNOFILE=10000
  62. # You can confirm it worked by running systemctl daemon-reload
  63. # then running systemctl show puppet | grep LimitNOFILE
  64. #
  65. [Unit]
  66. Description=Puppet agent
  67. Wants=basic.target
  68. After=basic.target network.target
  69.  
  70. [Service]
  71. EnvironmentFile=-/etc/sysconfig/puppetagent
  72. EnvironmentFile=-/etc/sysconfig/puppet
  73. EnvironmentFile=-/etc/default/puppet
  74. ExecStart=/usr/local/bin/puppet agent $PUPPET_EXTRA_OPTS --no-daemonize
  75. ExecReload=/bin/kill -HUP $MAINPID
  76. KillMode=process
  77.  
  78. [Install]
  79. WantedBy=multi-user.target
  80. EOF
  81. ```
  82. ```
  83. ln -s /lib/systemd/system/puppet.service /etc/systemd/system/multi-user.target.wants/puppet.service
  84. ```
  85.  
  86. #### Start the service automatically.
  87. This will fail if the .service file wasn't created properly.
  88. ```
  89. puppet resource service puppet ensure=running enable=true
  90. ```
  91.  
  92. #### Run puppet
  93. ```
  94. puppet agent -t
  95. ```
  96. That's pretty much it, remember that this will error out the first time as you need to sign the cert on the puppetmaster.
  97.  
  98. Still not sure why, but the first time I ran this I received an abnormal certificate error and needed to clear the certificates out of the master and agent.
  99. ```
  100. # On the master:
  101. # puppetserver ca clean --certname agenthostname.localdomain
  102. # On the agent:
  103. # 1. puppet ssl clean
  104. # 2. puppet agent -t
  105. ```
  106.  
  107. Good luck!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement