Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lj020326 committed Feb 17, 2022
0 parents commit 12f325a
Show file tree
Hide file tree
Showing 920 changed files with 26,881 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*/packer_cache/*
packer_cache/*
!packer_cache/.gitkeep
iso/*
*.iso
*/output-virtualbox-iso/*
*.box
*.ovf
*.vmdk
*.vdi
.vagrant/*
.DS_Store
.vscode/
output-*
private_vars.json
*.variables.json
Vagrantfile
venv/

.bundle/
virtualfloppy.vfd
/packer-*/
/builds/
.kitchen
.kitchen.yml
Gemfile.lock
Berksfile.lock
*.log

save/
.idea/
.DS_Store
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "ansible"]
path = ansible
url = [email protected]:lj020326/ansible-datacenter.git
branch = public
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2019 Jeff Geerling

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Dettonville Packer Builds

This project contains the Packer build configurations for all of Dettonville Boxes. Each box builds a minimal base box for use with Vsphere. Available boxes include:

You can also fork this repository and customize a build configuration with your own Ansible roles and playbooks to build a fully custom box using Packer.

## Requirements

The following software must be installed/present on your local machine before you can use Packer to build any of these Vagrant boxes:

- [Packer](http://www.packer.io/)
- [Vagrant](http://vagrantup.com/)
- [VirtualBox](https://www.virtualbox.org/)
- [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)

1 change: 1 addition & 0 deletions ansible
Submodule ansible added at 9be8a7
95 changes: 95 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
[defaults]
# default user to use for playbooks if user is not specified
# (/usr/bin/ansible will use current user as default)

# Use the YAML callback plugin.
## ref: https://www.jeffgeerling.com/blog/2018/use-ansibles-yaml-callback-plugin-better-cli-experience
stdout_callback = yaml

## ref: https://stackoverflow.com/questions/50009505/ansible-stdout-formatting/50017860
# Use the stdout_callback when running ad-hoc commands.
bin_ansible_callbacks = True

#ansible_user = deployer
#remote_user = root
#remote_user = deployer

host_key_checking = False

## ref: https://github.com/ansible/ansible/issues/21562
#remote_tmp = $HOME/.ansible/tmp
#local_tmp = $HOME/.ansible/tmp

## https://github.com/ansible/ansible/blob/308723c3ca1122363e419070f1fa1d76ff5611a9/docs/docsite/rst/user_guide/intro_dynamic_inventory.rst#using-inventory-directories-and-multiple-inventory-sources
#inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo
inventory_ignore_extensions = ~, .orig, .bak, .cfg, .retry, .pyc, .pyo

## ref: https://serverfault.com/questions/628989/how-to-set-default-ansible-username-password-for-ssh-connection
#inventory = ./hosts.ini
#inventory = inventory/hosts.ini

## ref: https://github.com/ansible/ansible/issues/5316#issuecomment-30749291
#inventory = inventory/hosts.ini,inventory/hosts-openstack.ini,inventory/openstack_inventory.py
inventory = inventory

forks=100

# pipelining
# Improves performance of execution
# Must be False for compatibility with sudoers (user postgres on rhel7) - role remote db
#
# Ansible page:
# This can result in a very significant performance improvement when enabled,
# however when using “sudo:” operations you must first disable ‘requiretty’ in /etc/sudoers on all managed hosts.
#pipelining = False

## to resolve "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user"
## ref: https://github.com/georchestra/ansible/issues/55
## ref: https://github.com/plone/ansible.plone_server/issues/86#issuecomment-226457346
pipelining=True

## ref: https://github.com/ansible/ansible/issues/21562
#remote_tmp = ~/.ansible/tmp
#local_tmp = ~/.ansible/tmp

## ref: https://docs.ansible.com/ansible/2.4/intro_configuration.html#log-path
#log_path=/var/log/ansible.log
log_path=ansible.log

[ssh_connection]
# when ssh throws 'unix domain socket "too long"' error
# see
# - https://github.com/ansible/ansible/issues/11536
# - http://stackoverflow.com/q/35970686/3834059
# - http://stackoverflow.com/q/35595468/3834059
#control_path = %(directory)s/%%h-%%p-%%r)
#ssh_args =
#ssh_args = -o StrictHostKeyChecking=no

## ref: https://stackoverflow.com/questions/51675831/ansible-stops-connecting-to-the-host-via-ssh
## ref: https://github.com/ansible/ansible/issues/16929
#ssh_args = -o ServerAliveInterval=50
#ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ServerAliveInterval=50
#ssh_args = -C -o ControlMaster=auto -o ControlPersist=30m -o ServerAliveInterval=50
#ssh_args = -o ControlMaster=no -o ControlPersist=2m -o ServerAliveInterval=50
ssh_args = -o ControlMaster=auto -o ControlPersist=2m -o ServerAliveInterval=50
scp_if_ssh = True


[inventory]
## how to enable fact caching on the ansible server
## ref: https://docs.ansible.com/ansible/latest/plugins/cache.html
cache=True
#cache=False

## If you configure Ansible with just the inventory plugin you are using,
## you avoid warnings about files not meeting the requirements of the other plugins.
## ref: https://github.com/ansible/ansible/issues/48859
#enable_plugins = ini

## ref: https://github.com/ansible/ansible/issues/40903
#enable_plugins = openstack

## ref: http://willthames.github.io/2017/11/01/generating-inventory.html
enable_plugins = host_list,script,auto,yaml,ini,toml,openstack

5 changes: 5 additions & 0 deletions buildTemplate.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env groovy

Map config = [:]

buildVmTemplate(config)
44 changes: 44 additions & 0 deletions fetch-osimages.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

// ref: https://serverfault.com/questions/987040/running-ansible-playbook-commands-inside-docker-image-using-jenkins-pipeline
pipeline {

agent {
label "docker-in-docker"
// label 'ansible'
}

// environment {
// ANSIBLE_VAULT_PASSWORD = credentials('ANSIBLE_VAULT_PASSWORD')
// }

options {
timeout(time: 60, unit: "MINUTES")
}

stages {
stage('Run Ansible playbook') {
agent {
docker {
image 'cytopia/ansible:latest'
args '-u 0:0'
reuseNode true
}
}
steps {
sh '''
ansible-playbook \
--inventory-file localhost, \
--extra-vars ansible_ssh_common_args='"-o StrictHostKeyChecking=no -o ServerAliveInterval=30"' \
fetch-osimages.yml
'''
}
}
}

post {
always {
deleteDir()
}
}

}
Loading

0 comments on commit 12f325a

Please sign in to comment.