Skip to content
This repository has been archived by the owner on Jun 12, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1 from WikipediaLibrary/dev-puppet-4.10
Browse files Browse the repository at this point in the history
Dev puppet 4.10
  • Loading branch information
jsnshrmn authored Jun 10, 2018
2 parents a251a27 + 6cdea35 commit 2cc38a5
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 66 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ New-Item -ItemType Junction -Path "$env:LOCALAPPDATA\lxss" -Value "$WSLFSPATH\ro

Clone this repository, which is where you will be running Vagrant.

You will probably need to tweak some of the settings for the [puppet module](https://github.com/WikipediaLibrary/twlight_puppet); to do so, edit the values in
You will need to configure some of the settings for the [puppet module](https://github.com/WikipediaLibrary/twlight_puppet); to do so, create the following yaml file:
```
./manifests/default.pp
./puppet/data/nodes/twlight.vagrant.localdomain.yaml
```
and make sure it contains at least the following (note the three dashes in the first line):
```
---
# The Oauth configuration required to make signin to the site work as expected.
twlight::params::oauth_key: 'a valid key given to you by a project member'
twlight::params::oauth_secret: 'a valid secret given to you by a project member'
```
along with any other parameters you'd like to override, such as the git repository or revision. See the [parameters manifest in the puppet module](https://github.com/WikipediaLibrary/twlight_puppet/blob/master/manifests/params.pp).

If you have a tarball that you'd like to load on provision, place it

Expand Down
48 changes: 34 additions & 14 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

twlight_puppet_version = "0.2.13"
twlight_puppet_version = "0.3.2"
#twlight_puppet_version = "master"

# Put "--debug " in this string if you want to test the limits of your terminal
# emulator's buffer.
twlight_puppet_options = "--confdir /vagrant/puppet --codedir /vagrant/puppet"
twlight_puppet_bin_path = "/opt/puppetlabs/puppet/bin"

Vagrant.configure("2") do |config|

# Name this thing
config.vm.define "twlight"
config.vm.hostname = "twlight.vagrant.localdomain"

if File.exists?(File.join(Dir.home, ".gitconfig"))
# Read local machine's gitconfig (~/.gitconfig)
gitconfig = File.read(File.join(Dir.home, ".gitconfig"))
Expand Down Expand Up @@ -33,36 +43,46 @@ Vagrant.configure("2") do |config|
if Vagrant.has_plugin?("vagrant-vbguest")
config.vm.synced_folder ".", "/vagrant", type: "virtualbox", mount_options: ['dmode=777', 'fmode=666']
config.vbguest.auto_update = false
# dump our static hosts file in
config.vm.provision "shell",
inline: "cp /vagrant/hosts /etc/hosts"

# Install puppet because we need it, and vim because the author of this Vagrantfile prefers it
# Install puppet because we need it, chrony because its useful in Vagrant,
# and vim because the author of this Vagrantfile prefers it.
config.vm.provision "shell",
inline: "apt-get install -y chrony puppet vim"
inline: "wget --quiet --timestamping --directory-prefix=/tmp \
https://apt.puppetlabs.com/puppetlabs-release-pc1-jessie.deb && \
dpkg -i /tmp/puppetlabs-release-pc1-jessie.deb && \
apt update && apt install -y chrony puppet-agent vim"


# Add github's host key to our known hosts file
config.vm.provision "shell",
inline: "ssh-keyscan -t rsa github.com >> /etc/ssh/ssh_known_hosts"

## Handy method for fetching puppet module from github
#config.vm.provision "shell",
# inline: "wget --quiet --timestamping --directory-prefix=/vagrant/modules \
# 'https://github.com/WikipediaLibrary/twlight_puppet/archive/"+ twlight_puppet_version +".tar.gz'"
# inline: "wget --quiet --timestamping --directory-prefix=/vagrant/puppet/modules \
# 'https://github.com/WikipediaLibrary/twlight_puppet/archive/"+ twlight_puppet_version +".tar.gz'"

## Install our twlight puppet module
## Install our twlight puppet module from github
#config.vm.provision "shell",
# inline: "puppet module install --target-dir /vagrant/modules \
# /vagrant/modules/"+ twlight_puppet_version +".tar.gz"
# inline: twlight_puppet_bin_path +"/puppet module install \
# "+ twlight_puppet_options +" --target-dir /vagrant/puppet/modules \
# /vagrant/puppet/modules/"+ twlight_puppet_version +".tar.gz"

# Install our twlight puppet module
# Install our twlight puppet module from puppet forge
config.vm.provision "shell",
inline: "puppet module install --target-dir /vagrant/modules \
inline: twlight_puppet_bin_path +"/puppet module install \
"+ twlight_puppet_options +" --target-dir /vagrant/puppet/modules \
jsnshrmn/twlight --version "+ twlight_puppet_version +";"

# Run the puppet provisioner
config.vm.provision "puppet" do |puppet|
puppet.module_path = "modules"
puppet.working_directory = "/vagrant/puppet"
puppet.hiera_config_path = "puppet/hiera.yaml"
puppet.environment = "local"
puppet.environment_path = "puppet/environments"
puppet.module_path = "puppet/modules"
puppet.binary_path = twlight_puppet_bin_path
puppet.options = twlight_puppet_options

# Run migration so any imported DB dump will work with current code.
config.vm.provision "shell",
Expand Down
7 changes: 0 additions & 7 deletions hosts

This file was deleted.

43 changes: 0 additions & 43 deletions manifests/default.pp

This file was deleted.

21 changes: 21 additions & 0 deletions puppet/data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# These variables set config values for OS and package configuration as well as
# the app. If you don't know what they are then you don't need to change them.
twlight::params::mysqlroot_pw: 'vagrant'
twlight::params::mysqltwlight_pw: 'vagrant'
twlight::params::restore_file: '/vagrant/backup/twlight.tar.gz'
twlight::params::backup_dir: '/vagrant/backup'
twlight::params::servername: 'twlight.vagrant.localdomain'
twlight::params::serverport: '80'
twlight::params::externalport: '80'
twlight::params::environment: 'local'

# These variables set config values for the app.
# If you don't know what they are then you don't need to change them.
twlight::params::secretkey: 'vagrant'
twlight::params::allowedhosts: "['twlight.vagrant.localdomain']"
twlight::params::baseurl: "http://${servername}/"
twlight::params::oauth_provider_url: "https://meta.wikimedia.org/w/index.php"

classes:
- twlight
File renamed without changes.
3 changes: 3 additions & 0 deletions puppet/environments/local/manifests/twlight.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node 'twlight.vagrant.localdomain' {
include twlight
}
16 changes: 16 additions & 0 deletions puppet/hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
version: 5
defaults:
datadir: /vagrant/puppet/data
data_hash: yaml_data
hierarchy:
- name: "Per-node data (yaml version)"
path: "nodes/%{trusted.certname}.yaml" # Add file extension.
# Omitting datadir and data_hash to use defaults.

- name: "Other YAML hierarchy levels"
paths: # Can specify an array of paths instead of one.
- "location/%{facts.whereami}/%{facts.group}.yaml"
- "groups/%{facts.group}.yaml"
- "os/%{facts.os.family}.yaml"
- "common.yaml"
4 changes: 4 additions & 0 deletions puppet/modules/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
2 changes: 2 additions & 0 deletions puppet/puppet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[main]
environment = local

0 comments on commit 2cc38a5

Please sign in to comment.