Skip to content

Instantly share code, notes, and snippets.

root@master:~ # puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Class[Ntp]:
parameter 'config_epp' expects a String value, got Hash
parameter 'config_template' expects a String value, got Hash
parameter 'keys_controlkey' expects a value of type ntp::key_id = Integer[1, 65534] or Pattern[/^\d+$/, //], got Hash[Unit, Unit, 0, 0]
parameter 'keys_requestkey' expects a value of type ntp::key_id = Integer[1, 65534] or Pattern[/^\d+$/, //], got Hash[Unit, Unit, 0, 0]
# install yamledit to be used with ansible to update yaml files
# this must be done on your master, infra and node hosts
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -i ./epel-release-latest-7.noarch.rpm
yum -y install python-pip
pip install ruamel.yaml
if [ ! -d yamledit ]
then
git clone https://github.com/microtodd/yamledit.git
fi
# commands to be used on the bastion host
file=/etc/origin/master/master-config.yaml
key=projectConfig.projectRequestMessage
value='Please create project using the portal or contact [email protected]'
# list entry
ansible masters -m command -a "/usr/local/sbin/yamledit -f ${file} -g ${key}"
# update entry
@msutter
msutter / pet-snippet.toml
Last active March 11, 2018 08:55
description
[[snippets]]
description = "Create a .keep file in all empty directories"
command = "find . -type d -empty -print0 | xargs -0 -I % touch %/.keep"
output = ""
[[snippets]]
description = "Display all listen port"
command = "lsof -Pan -i tcp -i udp"
output = ""
network-interfaces: |
auto lo
iface lo inet loopback
iface ens3 inet dhcp
iface ens4 inet dhcp
Jenkins.instance.pluginManager.plugins.each{
plugin ->
println ("${plugin.getShortName()}:${plugin.getVersion()}")
}
@msutter
msutter / master-node-config.groovy
Last active May 1, 2023 15:48
jenkins master node executors and restriction
#!groovy
import jenkins.model.*
import hudson.model.*
import hudson.slaves.*
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.nodes.JobRestrictionProperty;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.restrictions.job.RegexNameRestriction;
import com.synopsys.arc.jenkinsci.plugins.jobrestrictions.util.GroupSelector;
// Set nummber of executors
def instance = Jenkins.getInstance()
require 'git'
g = Git.open(working_dir)
untracked_files = gitstatus_untracked_workaround(g)
def gitstatus_untracked_workaround(g)
gem_rubygit_buggy_untracked_files = g.status.untracked.keys
git_files = `git --work-tree=#{g.dir} --git-dir=#{g.dir}/.git ls-files -z -d -m -o -X .gitignore`.split("\x0")
gem_rubygit_buggy_untracked_files & git_files
end