|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: "Getting started with OpenVox" |
| 4 | +--- |
| 5 | + |
| 6 | +# Getting started with OpenVox |
| 7 | + |
| 8 | +This guide walks you through the steps to go from a fresh installation to a working |
| 9 | +infrastructure managed with Puppet code. By the end you will have an OpenVox Server, |
| 10 | +enrolled agents, and a control repository deployed with r10k. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +**Want to try the full workflow locally first?** See |
| 15 | +[Try OpenVox locally with crafty](./getting_started_local.html) for a Docker Compose |
| 16 | +environment that mirrors these steps without needing dedicated servers. |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Step 1: Install OpenVox Server |
| 21 | + |
| 22 | +Install OpenVox Server on the node that will compile and serve **catalogs** to your |
| 23 | +agents. A catalog is the compiled set of resources and configuration that Puppet applies |
| 24 | +to a node. |
| 25 | + |
| 26 | +Follow the [OpenVox Server installation guide](/openvox-server/latest/install_from_packages.html) |
| 27 | +for full instructions. When complete, the `puppetserver` service should be running and |
| 28 | +reachable on port 8140. |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## Step 2: Install and enroll agents |
| 33 | + |
| 34 | +Install `openvox-agent` on each node you want to manage, then connect it to the server. |
| 35 | + |
| 36 | +1. Review the [pre-install tasks](./install_pre.html) for system requirements and |
| 37 | + network prerequisites. |
| 38 | +2. Install the agent: |
| 39 | + - [Linux](./install_linux.html) |
| 40 | + - [Windows](./install_windows.html) |
| 41 | + - [macOS](./install_osx.html) |
| 42 | +3. Run a test check-in on the agent. This submits a certificate signing request (CSR) |
| 43 | + to the server — OpenVox uses mutual TLS so both sides must trust each other before |
| 44 | + the server will issue a catalog: |
| 45 | + |
| 46 | + ```bash |
| 47 | + sudo /opt/puppetlabs/bin/puppet agent --test |
| 48 | + ``` |
| 49 | + |
| 50 | +4. Sign the certificate on the server to approve the agent: |
| 51 | + |
| 52 | + ```bash |
| 53 | + sudo /opt/puppetlabs/bin/puppetserver ca list |
| 54 | + sudo /opt/puppetlabs/bin/puppetserver ca sign --certname <AGENT_CERTNAME> |
| 55 | + ``` |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## Step 3: Set up a control repository |
| 60 | + |
| 61 | +A control repository is a Git repository that holds all your Puppet environments. |
| 62 | +Each branch becomes an [environment](./environments_about.html) on the server. r10k reads this repository and |
| 63 | +deploys branches to `/etc/puppetlabs/code/environments/`. |
| 64 | + |
| 65 | +### Create the repository |
| 66 | + |
| 67 | +Start by cloning the [puppetlabs/control-repo](https://github.com/puppetlabs/control-repo) |
| 68 | +template, which provides a well-structured starting point: |
| 69 | + |
| 70 | +```bash |
| 71 | +git clone https://github.com/puppetlabs/control-repo.git |
| 72 | +cd control-repo |
| 73 | +``` |
| 74 | + |
| 75 | +Create a new empty repository on your Git host (GitHub, GitLab, Gitea, or any host your |
| 76 | +server can reach), then point the clone at it. Note that OpenVox uses `production` as |
| 77 | +the default environment — make sure your repository's default branch is named |
| 78 | +`production`, not `main`: |
| 79 | + |
| 80 | +```bash |
| 81 | +git remote remove origin |
| 82 | +git remote add origin <YOUR_REPO_URL> |
| 83 | +git push -u origin production |
| 84 | +``` |
| 85 | + |
| 86 | +The template's key files are: |
| 87 | + |
| 88 | +- **`Puppetfile`** — lists modules r10k installs into the environment. Add modules from |
| 89 | + the Puppet Forge here as your infrastructure grows. |
| 90 | +- **`environment.conf`** — configures the module path to include the `site-modules/` |
| 91 | + directory alongside Forge modules. |
| 92 | +- **`site-modules/`** — where your own roles, profiles, and custom modules live. |
| 93 | +- **`manifests/site.pp`** — the main manifest, which is the entry point for node |
| 94 | + classification. |
| 95 | +- **`data/`** — Hiera data files, pre-configured with a basic hierarchy. |
| 96 | + |
| 97 | +### Install r10k |
| 98 | + |
| 99 | +[r10k](https://github.com/puppetlabs/r10k) is a code deployment tool that reads your |
| 100 | +control repository and installs each branch as a Puppet environment, along with any |
| 101 | +modules listed in its Puppetfile. |
| 102 | + |
| 103 | +On the OpenVox Server, install r10k using the Ruby runtime that ships with OpenVox: |
| 104 | + |
| 105 | +```bash |
| 106 | +sudo /opt/puppetlabs/puppet/bin/gem install r10k |
| 107 | +``` |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +Once your control repo is deployed and your infrastructure is established, consider |
| 112 | +managing r10k with the [`puppet/r10k`](https://forge.puppet.com/modules/puppet/r10k) |
| 113 | +Forge module. It installs r10k and manages `r10k.yaml` as Puppet resources, so |
| 114 | +changes to your r10k configuration go through the same code review and deployment |
| 115 | +workflow as everything else. |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +### Configure r10k |
| 120 | + |
| 121 | +Create the r10k configuration directory and a minimal `r10k.yaml`: |
| 122 | + |
| 123 | +```bash |
| 124 | +sudo mkdir -p /etc/puppetlabs/r10k |
| 125 | +``` |
| 126 | + |
| 127 | +**`/etc/puppetlabs/r10k/r10k.yaml`:** |
| 128 | + |
| 129 | +```yaml |
| 130 | +cachedir: '/var/cache/r10k' |
| 131 | +sources: |
| 132 | + control: |
| 133 | + remote: 'https://github.com/your-org/control-repo' |
| 134 | + basedir: '/etc/puppetlabs/code/environments' |
| 135 | +``` |
| 136 | +
|
| 137 | +Replace the `remote` value with the URL of your control repository. If the server |
| 138 | +needs an SSH key to clone from your Git host, configure that key for the root user |
| 139 | +before running r10k. |
| 140 | + |
| 141 | +### Deploy your first environment |
| 142 | + |
| 143 | +Deploy all branches from the control repository: |
| 144 | + |
| 145 | +```bash |
| 146 | +sudo /opt/puppetlabs/puppet/bin/r10k deploy environment -v |
| 147 | +``` |
| 148 | + |
| 149 | +When complete, `/etc/puppetlabs/code/environments/production/` will contain the |
| 150 | +files from your repository's `production` branch. |
| 151 | + |
| 152 | +--- |
| 153 | + |
| 154 | +## Step 4: Write and apply Puppet code |
| 155 | + |
| 156 | +With a deployed environment you are ready to write Puppet code and apply it to nodes. |
| 157 | +To confirm the full loop is working, add a `notify` resource to |
| 158 | +`manifests/site.pp` in your control repository: |
| 159 | + |
| 160 | +```puppet |
| 161 | +node default { |
| 162 | + notify { 'Hello from OpenVox!': |
| 163 | + message => 'Your first Puppet catalog change is working.', |
| 164 | + } |
| 165 | +} |
| 166 | +``` |
| 167 | + |
| 168 | +Commit and push the change to the `production` branch of your control repository, |
| 169 | +redeploy with r10k, then run the agent: |
| 170 | + |
| 171 | +```bash |
| 172 | +sudo /opt/puppetlabs/puppet/bin/r10k deploy environment production -v |
| 173 | +sudo /opt/puppetlabs/bin/puppet agent --test |
| 174 | +``` |
| 175 | + |
| 176 | +You should see a `Notice: Your first Puppet catalog change is working.` line in the |
| 177 | +output confirming the agent applied the updated catalog. |
| 178 | + |
| 179 | +From here, a few places to go deeper: |
| 180 | + |
| 181 | +- **[Hello world! Quick start guide](./quick_start_helloworld.html)** — write your first |
| 182 | + class and apply it to a node. |
| 183 | +- **[Roles and profiles](./the_roles_and_profiles_method.html)** — the recommended pattern |
| 184 | + for structuring code in larger deployments. |
| 185 | +- **[Installing modules](./modules_installing.html)** — add community modules from the |
| 186 | + Puppet Forge to your Puppetfile and deploy them with r10k. |
| 187 | +- **[Introduction to Hiera](./hiera_intro.html)** — separate your data from your code |
| 188 | + using Hiera. |
| 189 | + |
| 190 | +--- |
| 191 | + |
| 192 | +## What's next? |
| 193 | + |
| 194 | +- **Add more environments** — create a new branch in your control repository and run |
| 195 | + `r10k deploy environment -v` to deploy it. Use environments for testing changes |
| 196 | + before promoting to production. |
| 197 | +- **Automate r10k deploys** — use the [`r10k::webhook` class](https://forge.puppet.com/modules/puppet/r10k) |
| 198 | + from the `puppet/r10k` module to set up a webhook that triggers `r10k deploy environment` on every push. |
| 199 | +- **Expand your node inventory** — install agents on additional nodes and assign |
| 200 | + them classes in `manifests/site.pp` or through [node definitions](./lang_node_definitions.html). |
| 201 | +- **Classify nodes at scale** — use an [External Node Classifier](./nodes_external.html) |
| 202 | + to assign classes from an external source instead of maintaining node definitions |
| 203 | + in `manifests/site.pp`. |
0 commit comments