forked from DataDog/puppet-datadog-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vagrant-based testing environment (DataDog#462)
* Add vagrant-based testing environment with '#' will be ignored, and an empty message aborts the commit. * Update gitignore * Use versions in Puppetfile * Fix some paths in the readme * improve readme
- Loading branch information
1 parent
812494f
commit c3af4d7
Showing
5 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ Gemfile.lock | |
|
||
.rbenv-gemsets | ||
.ruby-version | ||
|
||
tests/.vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Test setup | ||
|
||
This is an example setup, based on vagrant + virtualbox, that allows to easily run puppet commands to test the module. | ||
|
||
# Requirements | ||
|
||
- vagrant > 2.0.0 | ||
- virtualbox > 5.1.28 | ||
|
||
# Setup | ||
|
||
in `puppet-datadog-agent/tests`: | ||
|
||
- provision VM: `vagrant up` | ||
- connect to the VM to check the configuration: `vagrant ssh` | ||
- destroy VM when needed: `vagrant destroy -f` | ||
|
||
## Module installation | ||
|
||
- The default `Puppetfile` installs the latest released version of the module from Puppetforge. | ||
- To use your development branch instead edit the Puppetfile et replace the `datadog-datadog_agent` with: | ||
``` | ||
mod 'datadog-datadog_agent', | ||
:git => 'https://github.com/DataDog/puppet-datadog-agent', | ||
:branch => '<my_branch>' | ||
``` | ||
|
||
- We can also build the module locally using the `puppet build` or `pdk build` command, upload the archive to the VM and install it with `sudo /opt/puppetlabs/bin/puppet module install datadog-datadog_agent-x.y.z.tar.gz --target-dir /home/vagrant/puppet/modules` | ||
|
||
|
||
## Manifest | ||
|
||
The default manifest is `tests/environment/manifests/site.pp` and simply run the module with the default options. | ||
We can edit the manifest and run `vagrant up --provision` to upload the new version to the VM. | ||
|
||
# Test | ||
|
||
In the VM, run `sudo /opt/puppetlabs/bin/puppet apply --modulepath=./modules ./manifests/site.pp` in `/home/vagrant/puppet` to apply to manifest on the VM. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = "puppetlabs/ubuntu-16.04-64-puppet" | ||
config.vm.box_version = "1.0.0" | ||
config.vm.provision "file", source: "./environment", destination: "$HOME/puppet" | ||
config.vm.provision "shell", inline: <<-SHELL | ||
/opt/puppetlabs/puppet/bin/gem install r10k -v 2.6.4 | ||
cd /home/vagrant/puppet | ||
sudo /opt/puppetlabs/puppet/bin/r10k puppetfile install | ||
SHELL | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mod 'datadog-datadog_agent' | ||
mod 'puppetlabs-apt', '2.4.0' | ||
mod 'puppetlabs-concat', '4.0.0' | ||
mod 'puppetlabs-puppetserver_gem', '1.0.0' | ||
mod 'puppetlabs-ruby', '1.0.0' | ||
mod 'puppetlabs-stdlib', '4.24.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node "localhost" { | ||
class { "datadog_agent": | ||
api_key => "somenonnullapikeythats32charlong", | ||
} | ||
} |