Skip to content

Instantly share code, notes, and snippets.

Constantin Bugneac Constantin07

Block or report user

Report or block Constantin07

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@soloradish
soloradish / vault_logrotate
Created Sep 12, 2018
logrotate setting file for HashiCorp's Vault audit file
View vault_logrotate
# Change the path below to your own audit log path.
/var/log/vault/audit.log {
rotate 30
daily
# Do not execute rotate if the log file is empty.
notifempty
missingok
compress
# Set compress on next rotate cycl to prevent entry loss when performing compression.
delaycompress
@ivan-pinatti
ivan-pinatti / jenkins-add-ssh-keypair-with-password-credential.groovy
Last active Dec 11, 2019
Jenkins - Add SSH keypair with password credential via groovy script - #jenkins #groovy #ssh #credential
View jenkins-add-ssh-keypair-with-password-credential.groovy
#!groovy
// imports
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.Domain
import com.cloudbees.plugins.credentials.impl.*
import hudson.util.Secret
import java.nio.file.Files
@odavid
odavid / Jenkins-delete-lockable-resources
Created Sep 14, 2017
A short script to delete free locks from the lockable resources plugin
View Jenkins-delete-lockable-resources
def manager = org.jenkins.plugins.lockableresources.LockableResourcesManager.get()
def resources = manager.getResources().findAll{
!it.locked
}
resources.each{
manager.getResources().remove(it)
}
manager.save()
@peterjenkins1
peterjenkins1 / harden-jenkins.groovy
Last active Apr 2, 2019
Harden Jenkins with groovy
View harden-jenkins.groovy
// Harden Jenkins and remove all the nagging warnings in the web interface
import jenkins.model.Jenkins
import jenkins.security.s2m.*
Jenkins jenkins = Jenkins.getInstance()
// Disable remoting
jenkins.getDescriptor("jenkins.CLI").get().setEnabled(false)
// Enable Agent to master security subsystem
@artburkart
artburkart / codedeploy_agent_install.yml
Last active Aug 13, 2018
Ansible scripts to install & run CodeDeploy not as unprivileged user on Ubuntu
View codedeploy_agent_install.yml
---
- name: Update apt cache
apt: update_cache=yes
- name: Install Ruby
apt: pkg=ruby2.0 state=present
- block:
- name: Get CodeDeploy version
set_fact:
@tomnomnom
tomnomnom / once-per-jenkins-slave.groovy
Created May 16, 2016
Run a command once on each Jenkins slave using the CloudBees Workflow / Jenkins Pipeline plugin
View once-per-jenkins-slave.groovy
// The ArrayList of slaves is not serializable, so fetching them should be marked as @NonCPS so that
// no attempt is made to serialize and save the local state of the function. See here for details:
// https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#serializing-local-variables
@NonCPS
def getSlaves() {
def slaves = []
hudson.model.Hudson.instance.slaves.each {
slaves << it.name
}
return slaves
@johnbuhay
johnbuhay / setup-users.groovy
Created Jan 21, 2016
jenkins init.groovy.d script for configuring users
View setup-users.groovy
import jenkins.*
import hudson.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
import hudson.model.*
import jenkins.model.*
import hudson.security.*
@babo
babo / aws_resources.py
Created Dec 20, 2015
Skeleton to list all AWS resources by security group.
View aws_resources.py
#!/usr/bin/env python3
import json
import boto3
def main():
all_ec2 = {}
all_rds = {}
all_cache = {}
all_elb = {}
@ceilfors
ceilfors / cleanupUnusedWorkspaceInSlaves.groovy
Last active Jan 13, 2020
When you delete jobs in Jenkins, the corresponding workspaces in the build slaves won't be deleted automatically. This Jenkins script will go to each slave and check if the jobs are already deleted in Jenkins master and delete the workspace.
View cleanupUnusedWorkspaceInSlaves.groovy
import com.cloudbees.hudson.plugins.folder.Folder
import hudson.FilePath
import jenkins.model.Jenkins
def boolean isFolder(String name) {
def item = Jenkins.instance.getItemByFullName(name)
return item instanceof Folder
}
def deleteUnusedWorkspace(FilePath root, String path) {
@noonat
noonat / coreos-virtualbox.md
Last active Feb 18, 2020
Installing CoreOS on VirtualBox
View coreos-virtualbox.md
  • Download and install VirtualBox.
  • Download the CoreOS ISO
  • Create a new VM in VirtualBox
    • For the OS, Other Linux, 64-bit should be fine
    • Give the VM 1gb of memory, like your physical hardware has.
    • Create a disk of whatever size you want. I made a VMDK file that could expand dynamically up to 8gb.
  • Mount the ISO in the VM
    • Right click on the VM and click settings
    • Go to the storage tab
You can’t perform that action at this time.