Skip to content

Commit 60b79c1

Browse files
authored
Merge pull request #580 from DataDog/albertvaka/centos-test
Add centos test machine
2 parents 5ee213f + b187284 commit 60b79c1

6 files changed

Lines changed: 27 additions & 11 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Gemfile.lock
88
.rbenv-gemsets
99
.ruby-version
1010

11-
tests/.vagrant
11+
tests/centos/.vagrant
12+
tests/ubuntu/.vagrant
1213

1314
# mac stuff
1415
.DS_Store

tests/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,25 @@ This is an example setup, based on vagrant + virtualbox, that allows to easily r
99

1010
# Setup
1111

12-
in `puppet-datadog-agent/tests`:
12+
in `puppet-datadog-agent/tests/ubuntu` or `puppet-datadog-agent/tests/centos`:
1313

1414
- provision VM: `vagrant up`
1515
- connect to the VM to check the configuration: `vagrant ssh`
1616
- destroy VM when needed: `vagrant destroy -f`
1717

1818
## Module installation
1919

20-
- The default `Puppetfile` installs the latest released version of the module from Puppetforge.
20+
- The default `Puppetfile` (in `environment/Puppetfile`) installs the latest released version of the module from Puppetforge.
2121
- To use your development branch instead edit the Puppetfile et replace the `datadog-datadog_agent` with:
2222
```
2323
mod 'datadog-datadog_agent',
2424
:git => 'https://github.com/DataDog/puppet-datadog-agent',
25-
:branch => '<my_branch>'
25+
:branch => '<my_branch>'
2626
```
2727

28-
- 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`
28+
- 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:
29+
- Ubuntu VM: `sudo /opt/puppetlabs/bin/puppet module install datadog-datadog_agent-x.y.z.tar.gz --target-dir /home/vagrant/puppet/modules`
30+
- CentOS VM: `sudo /usr/local/bin/puppet module install datadog-datadog_agent-x.y.z.tar.gz --target-dir /home/vagrant/puppet/modules`
2931

3032

3133
## Manifest
@@ -35,4 +37,5 @@ We can edit the manifest and run `vagrant up --provision` to upload the new vers
3537

3638
# Test
3739

38-
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.
40+
In the CentOS VM, run `sudo /usr/local/bin/puppet apply --modulepath=./modules ./manifests/site.pp` in `/home/vagrant/puppet` to apply to manifest on the VM.
41+
In the Ubuntu VM, run `sudo /opt/puppetlabs/bin/puppet apply --modulepath=./modules ./manifests/site.pp` in `/home/vagrant/puppet` to apply to manifest on the VM.

tests/centos/Vagrantfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Vagrant.configure("2") do |config|
2+
config.vm.box = "generic/centos8"
3+
config.vm.provision "file", source: "../environment", destination: "$HOME/puppet"
4+
config.vm.provision "shell", inline: <<-SHELL
5+
sudo yum install -y gem nano
6+
sudo gem install puppet r10k
7+
echo 'export PATH=$PATH:/usr/local/bin' | sudo tee /etc/bashrc
8+
cd /home/vagrant/puppet
9+
/usr/local/bin/r10k puppetfile install
10+
SHELL
11+
end

tests/environment/Puppetfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ mod 'puppetlabs-concat', '4.0.0'
44
mod 'puppetlabs-puppetserver_gem', '1.0.0'
55
mod 'puppetlabs-ruby', '1.0.0'
66
mod 'puppetlabs-stdlib', '4.24.0'
7-
mod 'puppetlabs-powershell', '2.3.0'
7+
mod 'puppetlabs-powershell', '2.3.0'
8+
mod 'puppetlabs-yumrepo_core', '1.0.3'

tests/environment/manifests/site.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
node "localhost" {
1+
node default {
22
class { "datadog_agent":
33
api_key => "somenonnullapikeythats32charlong",
44
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Vagrant.configure("2") do |config|
22
config.vm.box = "puppetlabs/ubuntu-16.04-64-puppet"
33
config.vm.box_version = "1.0.0"
4-
config.vm.provision "file", source: "./environment", destination: "$HOME/puppet"
4+
config.vm.provision "file", source: "../environment", destination: "$HOME/puppet"
55
config.vm.provision "shell", inline: <<-SHELL
6-
/opt/puppetlabs/puppet/bin/gem install r10k -v 2.6.4
6+
/opt/puppetlabs/puppet/bin/gem install r10k -v 2.6.7
77
cd /home/vagrant/puppet
88
sudo /opt/puppetlabs/puppet/bin/r10k puppetfile install
99
SHELL
10-
end
10+
end

0 commit comments

Comments
 (0)