Guest User

Untitled

a guest
Nov 8th, 2018
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. First install Puppet Platform:
  2. *** Debian 9
  3. wget https://apt.puppetlabs.com/puppet6-release-stretch.deb
  4. dpkg -i puppet6-release-stretch.deb
  5. apt-get update
  6. ***
  7. For other linux distros, look at
  8. https://puppet.com/docs/puppet/6.0/puppet_platform.html
  9.  
  10. Install Puppet Agent:
  11. *** Apt-based systems
  12. apt-get install puppet-agent
  13. ***
  14. For other systems, look at
  15. https://puppet.com/docs/puppet/6.0/install_linux.html
  16.  
  17. Start puppet and ensure running:
  18. ***
  19. /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true
  20. ***
  21.  
  22. Install PuppetDB:
  23. ***
  24. /opt/puppetlabs/bin/puppet resource package puppetdb ensure=latest
  25. ***
  26.  
  27. Install Postgresql
  28. ***
  29. apt install postgresql postgresql-contrib
  30. ***
  31.  
  32. To check version of postgresql
  33. ***
  34. sudo -u postgres psql -c "SELECT version();"
  35. ***
  36. This also means you've got a new user called "postgres".
  37.  
  38. You now have log in to "postgres". From root, it's just
  39. ***
  40. su - postgres
  41. ***
  42.  
  43. Install pg_trgm
  44. ***
  45. psql
  46. CREATE EXTENSION pg_trgm;
  47. \q
  48. ***
  49. "psql" puts you in the postgresql console.
  50. "\q" quits the console,
  51.  
  52.  
  53. Thereafter, you need to create a user and database for puppetDB, and set it to use UTF8
  54. ***
  55. createuser -DRSP puppetdb
  56. createdb -O puppetdb puppetdb
  57. /usr/lib/postgresql/9.6/bin/initdb -E UTF8 -D puppetdb
  58. ***
  59.  
  60. Edit /etc/postgresql/9.6/main/pg_hba.conf
  61. We need to allow md5 authentication. Edit line 90 from
  62.  
  63. local all all peer
  64. to
  65. local all all md5
  66.  
  67.  
  68. Restart PostgreSQL and ensure you can log in by running
  69. ***
  70. service postgresql restart
  71. psql -h localhost puppetdb puppetdb
  72. ***
  73. Now quit the console ("\q").
  74.  
  75. Configure puppetDB to use the postgresql database.
  76. This is to be done in /etc/puppetlabs/puppetdb/conf.d/databse.ini
  77. Add the following lines:
  78. ***
  79. subname = //lcoalhost:5432/puppetdb
  80. username = puppetdb
  81. password = Pupp37
  82. ***
  83. Make sure the host, port, and database are the correct ones.
  84. To figure out the port:
  85. ***
  86. netstat -plunt |grep postgres
  87. ***
  88.  
  89. This should be it for puppetdb. If you wish to configure [many] more settings, look at https://puppet.com/docs/puppetdb/6.0/configure.html
  90.  
  91. Now to configure the puppet master to use puppetdb.
  92. Install the puppetdb-termini package:
  93. ***
  94. /opt/puppetlabs/bin/puppet resource package puppetdb-termini ensure=latest
  95. ***
  96.  
  97. Go into /etc/puppetlabs/puppet. We need to edit/create three files in here.
  98. Check whether "puppetdb.conf" exists; if not, do
  99. ***
  100. touch puppetdb.conf
  101. ***
  102. This creates a file.
  103. In here, we need to add the URL of puppetDB's URL (remember to have it in a DNS either now or later).
  104. Add the following lines:
  105. ***
  106. [main]
  107. server_urls = https://intern:8081
  108. *** (This is the server name for the puppet master where everything is installed.)
  109. HTTPS is *required*.
  110. Remember to change accordingly.
  111. If you want to check on more settings, look at: https://puppet.com/docs/puppetdb/6.0/puppetdb_connection.html
  112.  
  113. Edit puppet.conf.
  114. To enable saving facts and catalogs in PuppetDB, edit the [master] block of puppet.conf to reflect the following settings:
  115. ***
  116. [master]
  117. storeconfigs = true
  118. storeconfigs_backend = puppetdb
  119. ***
  120. Note: The thin_storeconfigs and async_storeconfigs settings should be absent or set to false. If you previously used the Puppet queue daemon (puppetqd), you should now disable it.
  121.  
  122. Check wheter "routes.yaml" exists; if not, do
  123. ***
  124. touch routes.yaml
  125. ***
  126.  
  127. In that file, add the following lines:
  128. ***
  129. ---
  130. master:
  131. facts:
  132. terminus: puppetdb
  133. cache: yaml
  134. ***
  135.  
  136. The files created above need to be owned by the puppet user. Ensure that this ownership is applied by running the following command:
  137. ***
  138. chown -R puppet:puppet `sudo /opt/puppetlabs/puppet/bin/puppet config print confdir`
  139. ***
  140.  
  141. Now install and re/start puppet and puppetserver:
  142. ***
  143. apt install puppetserver
  144. systemctl restart puppet puppetserver
  145. ***
  146.  
  147. And turn on puppetdb and ensure running:
  148. ***
  149. /opt/puppetlabs/puppet/bin/puppet resource service puppetdb ensure=running enable=true
  150. ***
  151. This might take a while, so consider using "screen", to avoid "ssh broken pipes".
  152.  
  153. That's it! Puppet, puppetserver and puppetdb are now running!
Advertisement
Add Comment
Please, Sign In to add comment