**Purpose**: At this point, we need to configure Gitea as the storage repository for the Puppet "Environments" (e.g. `Production` and `Development`). We can do this by leveraging a tool called "r10k" which pulls a Git repository and configures it as the environment in Puppet. ## Install r10k ``` sh # Install r10k Pre-Requisites sudo dnf install -y ruby ruby-devel gcc make # Install r10k Gem (The Software) # Note: If you encounter any issues with permissions, you can install the gem with "sudo gem install r10k --no-document". sudo gem install r10k # Verify the Installation (Run this as a non-root user) r10k version ``` ## Configure r10k ``` sh # Create the r10k Configuration Directory sudo mkdir -p /etc/puppetlabs/r10k # Create the r10k Configuration File sudo nano /etc/puppetlabs/r10k/r10k.yaml ``` ```yaml title="/etc/puppetlabs/r10k/r10k.yaml" --- # Cache directory for r10k cachedir: '/var/cache/r10k' # Sources define which repositories contain environments sources: puppet: remote: 'https://git.bunny-lab.io/GitOps/Puppet.git' basedir: '/etc/puppetlabs/code/environments' ``` ``` sh # Create r10k Cache Directory sudo mkdir -p /var/cache/r10k sudo chown -R puppet:puppet /var/cache/r10k ``` ## Configure Gitea At this point, we need to set up the branches and folder structure of the Puppet repository on Gitea. ``` sh # Clone Repository (Provide Credentials and App Token for the Password to the Repository) sudo yum install -y git cd /tmp git clone https://git.bunny-lab.io/GitOps/Puppet.git cd Puppet git checkout -b production git push -u origin production git checkout -b development git push -u origin development nano Puppetfile ``` ```yaml title="/tmp/Puppet/PuppetFile" # Puppetfile forge 'https://forge.puppet.com' # Modules from Puppet Forge mod 'puppetlabs-stdlib', '>= 6.0.0 < 9.0.0' ```