Skip to content

Instantly share code, notes, and snippets.

@rodrickbrown
Created April 18, 2018 12:53
Show Gist options
  • Save rodrickbrown/0e4bc0f6279884d9b8de942f27859e1d to your computer and use it in GitHub Desktop.
Save rodrickbrown/0e4bc0f6279884d9b8de942f27859e1d to your computer and use it in GitHub Desktop.
{
"variables": {
"platform_name": "CentOS",
"platform_version": "7"
},
"builders": [{
"type": "amazon-ebs",
"name": "HVM AMI builder",
"region": "us-west-2",
"source_ami": "ami-0c2aba6c",
"instance_type": "t2.nano",
"ssh_username": "centos",
"ami_name": "CentOS 7 - 1703_01 (built on {{isotime \"20060102150405\"}})",
"tags": {
"platform_name": "{{user `platform_name`}}",
"platform_version": "{{user `platform_version`}}"
}
}],
"provisioners": [{
"type": "file",
"source": "builder",
"destination": "/tmp/"
}, {
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }}; sudo {{ .Path }}",
"scripts": [
"builder/install.sh"
]
}, {
"type": "ansible-local",
"playbook_file": "ansible/plays/common.yml",
"playbook_dir": "ansible/",
"role_paths": [
"ansible/roles"
]
}]
}
$ cat builder/install.sh
#!/bin/bash
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin
yum update -y
yum upgrade -y
yum -y install epel-release
yum -y install jq awscli nc tcpdump libselinux-python python-pip bind-utils nmap screen tmux iotop facter rubygem-json python2-virtualenv python3-virtualenv
pip install prettytable ansible>=2.4.1.0
groupadd -g 5000 octane
useradd -g 5000 -s /bin/bash -d /home/octane -m octane -u 5000
# ensure the overlay module is loaded - required for docker
echo overlay > /etc/modules-load.d/overlay.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment