Skip to content

Commit 31ca191

Browse files
authored
Make test environments use the local module (DataDog#607)
1 parent 39a323e commit 31ca191

5 files changed

Lines changed: 36 additions & 16 deletions

File tree

environments/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@ We can edit the manifest and run `vagrant up --provision` to upload the new vers
3737

3838
# Test
3939

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.
40+
In a VM, run `sudo puppet apply --modulepath=./modules ./manifests/site.pp` in `/home/vagrant/puppet` to apply to manifest on the VM.

environments/centos7/Vagrantfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
Vagrant.configure("2") do |config|
22
config.vm.box = "generic/centos7"
3-
config.vm.provision "file", source: "../../../environments/etc", destination: "$HOME/puppet"
3+
config.vm.provision "file", source: "../../environments/etc", destination: "$HOME/puppet"
4+
config.vm.synced_folder "../../", "/puppet-datadog-agent"
45
config.vm.provision "shell", inline: <<-SHELL
5-
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
6+
#install puppet 5
7+
rpm -ivh http://yum.puppetlabs.com/puppet5-release-el-7.noarch.rpm
68
yum install -y puppet
7-
systemctl start puppet
8-
systemctl enable puppet
9+
ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
910
10-
gem install r10k -v 2.6.7
11+
# install modules
1112
cd /home/vagrant/puppet
12-
sudo su vagrant -c "/usr/local/bin/r10k puppetfile install --moduledir=/tmp/modules"
13+
/opt/puppetlabs/puppet/bin/gem install r10k -v 2.6.7
14+
/opt/puppetlabs/puppet/bin/r10k puppetfile install --moduledir=/home/vagrant/puppet/modules
15+
16+
# link local module
17+
ln -s /puppet-datadog-agent /home/vagrant/puppet/modules/datadog_agent
1318
SHELL
1419
end

environments/centos8/Vagrantfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
Vagrant.configure("2") do |config|
22
config.vm.box = "generic/centos8"
3-
config.vm.provision "file", source: "../../../environments/etc", destination: "$HOME/puppet"
3+
config.vm.provision "file", source: "../../environments/etc", destination: "$HOME/puppet"
4+
config.vm.synced_folder "../../", "/puppet-datadog-agent"
45
config.vm.provision "shell", inline: <<-SHELL
6+
#install puppet 6
57
dnf install -y https://yum.puppetlabs.com/puppet-release-el-8.noarch.rpm
68
dnf install -y puppet
7-
systemctl start puppet
8-
systemctl enable puppet
9+
ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
910
10-
/opt/puppetlabs/puppet/bin/gem install r10k -v 2.6.7
11+
# install modules
1112
cd /home/vagrant/puppet
12-
sudo su vagrant -c "/opt/puppetlabs/puppet/bin/r10k puppetfile install --moduledir=/tmp/modules"
13+
/opt/puppetlabs/puppet/bin/gem install r10k -v 2.6.7
14+
/opt/puppetlabs/puppet/bin/r10k puppetfile install --moduledir=/home/vagrant/puppet/modules
15+
16+
# link local module
17+
ln -s /puppet-datadog-agent /home/vagrant/puppet/modules/datadog_agent
1318
SHELL
1419
end

environments/etc/Puppetfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Track control branch and fall-back to master if no matching branch.
2+
mod 'datadog_agent', :local => true
13
mod 'puppetlabs-apt', '2.4.0'
24
mod 'puppetlabs-concat', '4.0.0'
35
mod 'puppetlabs-puppetserver_gem', '1.0.0'
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
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: "../../../environments/etc", destination: "$HOME/puppet"
4+
config.vm.provision "file", source: "../../environments/etc", destination: "$HOME/puppet"
5+
config.vm.synced_folder "../../", "/puppet-datadog-agent"
56
config.vm.provision "shell", inline: <<-SHELL
6-
/opt/puppetlabs/puppet/bin/gem install r10k -v 2.6.7
7+
8+
#install puppet 4
9+
ln -s /opt/puppetlabs/puppet/bin/puppet /usr/bin/puppet
10+
11+
# install modules
712
cd /home/vagrant/puppet
8-
su vagrant -c "/opt/puppetlabs/puppet/bin/r10k puppetfile install --moduledir=/tmp/modules"
13+
/opt/puppetlabs/puppet/bin/gem install r10k -v 2.6.7
14+
/opt/puppetlabs/puppet/bin/r10k puppetfile install --moduledir=/home/vagrant/puppet/modules
15+
16+
# link local module
17+
ln -s /puppet-datadog-agent /home/vagrant/puppet/modules/datadog_agent
918
SHELL
1019
end

0 commit comments

Comments
 (0)