Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alvagante committed Jun 24, 2016
1 parent 074cada commit e0b4b16
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 20 deletions.
7 changes: 5 additions & 2 deletions bin/install_githooks.sh
Expand Up @@ -10,8 +10,11 @@ main_dir=$(git rev-parse --show-toplevel)
echo "Executing: git clone ${hooks_repo} /var/tmp/"
git clone ${hooks_repo} /var/tmp/puppet-git-hooks

echo "Copying /var/tmp/puppet-git-hooks/commit_hooks/* in ${main_dir}/.git/hooks"
cp -rvpn /var/tmp/puppet-git-hooks/commit_hooks/* "${main_dir}/.git/hooks"
echo "Copying /var/tmp/puppet-git-hooks/commit_hooks in ${main_dir}/.git/hooks"
cp -rvpn /var/tmp/puppet-git-hooks/commit_hooks "${main_dir}/.git/hooks"

echo "Copying /var/tmp/puppet-git-hooks/pre-commit in ${main_dir}/.git/hooks"
cp -rvpn /var/tmp/puppet-git-hooks/pre-commit "${main_dir}/.git/hooks"

echo
echo "Git hooks from ${hooks_repo}"
Expand Down
2 changes: 1 addition & 1 deletion bin/papply.sh
Expand Up @@ -3,7 +3,7 @@ repo_dir="$(dirname $0)/../"
manifest="${repo_dir}/manifests/site.pp"
extra_options=$*

PATH=$PATH:/opt/puppetlabs/bin
PATH=$PATH:/opt/puppetlabs/puppet/bin

echo "## Running Puppet version $(puppet --version) on ${manifest}"

Expand Down
4 changes: 2 additions & 2 deletions bin/publish.sh
Expand Up @@ -98,9 +98,9 @@ fi
modulename=$(basename `pwd`)
branch=$(git branch --no-column | grep '*' | cut -c 3-)

if [ ! -f manifests/init.pp ] ; then
if [ ! -f metadata.json ] ; then
echo_title "SOMETHING WRONG"
echo "I don't find manifests/init.pp "
echo "I don't find metadata.json "
echo "Run this script from a module directory or specify -m modulename"
showhelp
exit 1
Expand Down
12 changes: 12 additions & 0 deletions bin/puppet_code_deploy.sh
@@ -0,0 +1,12 @@
#!/bin/bash
environment=$1
environmentpath=$(puppet config print environmentpath)
cert=$(puppet config print environmentpath)
key=$(puppet config print )
cacert=$(puppet config print cacert)

cd "${environmentpath}/${environment}"
git pull origin $environment
r10k puppetfile install

curl -i --cert $cert --key $key --cacert $cacert -X DELETE https://localhost:8140/puppet-admin-api/v1/environment-cache?environment=$environment
Empty file modified bin/setup_controlrepo.sh 100644 → 100755
Empty file.
15 changes: 12 additions & 3 deletions docker.py
@@ -1,13 +1,22 @@
from fabric.api import *

@task
def provision(puppetrole='log', image='ubuntu-14.04'):
def build_role(puppetrole='docker_test', image='ubuntu-14.04'):
"""Build a Docker image of the specified role and OS (data in hieradata/role/$puppetrole.yaml)"""
local('cd docker ; ./dockerize_role.sh ' + str(puppetrole) + ' ' + str(image) )
@task
def build_role_multios(puppetrole):
"""Build multi OS Docker images of the specified role (data in hieradata/role/$puppetrole.yaml)"""
local( 'cd docker ; ./dockerize_role_all_os.sh ' + str(puppetrole) )

@task
def test_role(puppetrole='log', image='ubuntu-14.04'):
"""Test a role on the specified OS on Docker"""
local('docker/test.sh ' + str(puppetrole) + ' ' + str(image) )

@task
def multios_build():
"""Build Docker images based on the data in hieradata/role/docker_multios_build.yaml"""
def build_multios():
"""Build multi OS Docker images based on the data in hieradata/role/docker_multios_build.yaml"""
local( 'cd docker ; ./generate_all.sh' )

@task
Expand Down
9 changes: 9 additions & 0 deletions docker/dockerize_role.sh
@@ -0,0 +1,9 @@
#!/bin/bash
image=$2
role=$1

. config
. env/${image}

echo "## Building on image ${image} role ${role}"
puppet apply -t --basemodulepath "../modules" --hiera_config "hiera.yaml" -e 'include ::docker::profile::rocker_builder'
5 changes: 5 additions & 0 deletions docker/dockerize_role_all_os.sh
@@ -0,0 +1,5 @@
#!/bin/bash
role=$1
for os in $(ls -1 env/* | sed 's/env\///g'); do
./dockerize_role.sh $role $os
done
1 change: 1 addition & 0 deletions fabfile.py
@@ -1,4 +1,5 @@
from fabric.api import *

import vagrant
import puppet
import git
Expand Down
2 changes: 1 addition & 1 deletion hiera.yaml
Expand Up @@ -4,7 +4,7 @@

:hierarchy:
- "hostname/%{::trusted.certname}"
- "role/%{::role}-${::env}"
- "role/%{::role}-%{::env}"
- "role/%{::role}"
- "zone/%{::zone}"
- common
Expand Down
5 changes: 1 addition & 4 deletions hieradata/common.yaml
@@ -1,8 +1,4 @@
---
profiles:
- '::profile::base::linux'
# - '::ansible::user'

# Default tp behaviour
tp::test_enable: true
tp::puppi_enable: false
Expand All @@ -11,6 +7,7 @@
# Default module to use for tp data:
tp::data_module: tinydata

# Base profile settings
profile::base::linux::pre_class: '::profile::pre'
profile::base::linux::mail_class: ''
profile::base::linux::puppet_class: '::puppet'
Expand Down
11 changes: 11 additions & 0 deletions hieradata/role/docker_multios_build.yaml
@@ -1,6 +1,7 @@
---
profiles:
- '::docker::profile::builder'
- '::docker::profile::rocker_builder'

docker::username: example42
docker::install_class: ''
Expand All @@ -19,3 +20,13 @@ docker::profile::builder::images:
template: 'docker/setup_papply.sh'
mode: '0755'
group: 'wheel'

docker::profile::rocker_bilder::maintainer: 'Example42 GmbH <info@example42.com>'
docker::profile::rocker_builder::workdir: '/var/tmp/rockerfiles'
docker::profile::rocker_builder::always_build: true
docker::profile::rocker_builder::push: false
docker::profile::rocker_builder::images:
tpweb:
ensure: present
puppet_facts:
role: tpweb
3 changes: 3 additions & 0 deletions hieradata/role/docker_test.yaml
@@ -0,0 +1,3 @@
---
profiles:
- '::rails::profile::tpweb'
10 changes: 3 additions & 7 deletions manifests/site.pp
Expand Up @@ -27,8 +27,10 @@
# otherwise we install Puppet 4 agent

if versioncmp($::puppetversion, '4.0.0') >= 0 {
# $kernel_down may be used to include ::profile::base classes for different OS

# With multi kernel clients better include different base profiles classes.
$kernel_down=downcase($::kernel)
contain "::profile::base::${kernel_down}"

# Classification option 1 - Profiles defined in Hiera
hiera_include('profiles',[])
Expand All @@ -39,12 +41,6 @@
# Class["::profile::base::${kernel_down}"] -> Class["::role::${::role}"]
# }

# With multi kernel clients better include different base profiles classes.
# Note: If you uncomment the contain below you have to comment in
# hieradata/common.yaml the line: - '::profile::base::linux'
#
# contain "::profile::base::${kernel_down}"

} else {
# All the code here is Puppet 4 only compliant.
# Nodes with Puppet 3 are upgraded
Expand Down
4 changes: 4 additions & 0 deletions site/profile/manifests/sysdig.pp
@@ -0,0 +1,4 @@
#
class profile::sysdig {
tp::install { 'sysdig': }
}

0 comments on commit e0b4b16

Please sign in to comment.