Update Servers & Workflows/Linux/Automation/Puppet/Puppet Deployment.md
This commit is contained in:
@ -18,7 +18,7 @@ sudo rpm -Uvh https://yum.puppet.com/puppet7-release-el-9.noarch.rpm
|
||||
**Installation Scope**: Puppet Server
|
||||
``` sh
|
||||
# Install the Puppet Server
|
||||
yum install -y puppetserver
|
||||
sudo yum install -y puppetserver
|
||||
systemctl enable --now puppetserver
|
||||
|
||||
# Validate Successful Deployment
|
||||
@ -95,7 +95,7 @@ sources:
|
||||
|
||||
``` sh
|
||||
# Lockdown the Permissions of the Configuration File
|
||||
chmod 600 /etc/puppetlabs/r10k/r10k.yaml
|
||||
sudo chmod 600 /etc/puppetlabs/r10k/r10k.yaml
|
||||
|
||||
# Create r10k Cache Directory
|
||||
sudo mkdir -p /var/cache/r10k
|
||||
@ -121,26 +121,32 @@ Navigate to "**Gitea > User (Top-Right) > Settings > Applications
|
||||
Now we want to configure Gitea to store the credentials for later use by r10k:
|
||||
``` sh
|
||||
# Enable Stored Credentials (We will address security concerns further down...)
|
||||
git config --global credential.helper store
|
||||
sudo yum install -y git
|
||||
sudo git config --global credential.helper store
|
||||
|
||||
# Clone the Git Repository Once to Store the Credentials (Use the Application Token as the password)
|
||||
# Username: nicole.rappe
|
||||
# Password: <Application Token Value>
|
||||
git clone https://git.bunny-lab.io/GitOps/Puppet.git /tmp/PuppetTest
|
||||
sudo git clone https://git.bunny-lab.io/GitOps/Puppet.git /tmp/PuppetTest
|
||||
|
||||
# Verify the Credentials are Stored
|
||||
cat /root/.git-credentials
|
||||
sudo cat /root/.git-credentials
|
||||
|
||||
# Lockdown Permissions
|
||||
chmod 600 /root/.git-credentials
|
||||
sudo chmod 600 /root/.git-credentials
|
||||
|
||||
# Cleanup After Ourselves
|
||||
rm -rf /tmp/PuppetTest
|
||||
sudo rm -rf /tmp/PuppetTest
|
||||
```
|
||||
|
||||
Finally we validate that everything is working by pulling down the Puppet environments using r10k on the Puppet Server:
|
||||
``` sh
|
||||
# Deploy Puppy Environments from Gitea
|
||||
sudo /usr/local/bin/r10k deploy environment -p
|
||||
|
||||
# Validate r10k is Installing Modules in the Environments
|
||||
sudo ls /etc/puppetlabs/code/environments/production/modules
|
||||
sudo ls /etc/puppetlabs/code/environments/development/modules
|
||||
```
|
||||
|
||||
!!! success "Successful Puppet Environment Deployment
|
||||
@ -214,6 +220,13 @@ sudo systemctl restart puppetserver
|
||||
## Pull Puppet Environments from Gitea
|
||||
At this point, we can tell r10k to pull down the Puppet environments (e.g. `Production` and `Development`) that we made in the Gitea repository in previous steps. Run the following command on the Puppet Server to pull down the environments. This will download / configure any Puppet Forge modules as well as any hand-made modules such as Neofetch.
|
||||
``` sh
|
||||
sudo /usr/local/bin/r10k deploy environment production -p
|
||||
sudo /usr/local/bin/r10k deploy environment development -p
|
||||
sudo /usr/local/bin/r10k deploy environment -p
|
||||
# OPTIONAL: You can pull down a specific environment instead of all environments if you specify the branch name, seen here:
|
||||
#sudo /usr/local/bin/r10k deploy environment development -p
|
||||
```
|
||||
|
||||
## Apply PuppetDB Configuration to Puppet Server
|
||||
At this point, we are going to deploy the configuration from Gitea to the Puppet Server so it installs PuppetDB automatically.
|
||||
``` sh
|
||||
sudo /opt/puppetlabs/bin/puppet agent -t
|
||||
```
|
Reference in New Issue
Block a user