Skip to content

Commit

Permalink
Merge branch 'straight-to-ova'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Van Fleet committed Aug 29, 2016
2 parents 906381a + 0e77e9b commit 941eb09
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ output-virtualbox-iso/*
builds/*
output-xfs/*
output-ext4/*
ansible-playbooks
24 changes: 24 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!groovy

node('packer') {
stage 'Checkout'

checkout scm

stage 'Acquire ansible-playbooks'

sh 'mkdir -p ansible-playbooks'
dir('ansible-playbooks'){
git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git",
branch: "shibboleth-production", credentialsId: "jenkins-github-access-token" ])
}

stage 'Validate'

sh '/usr/local/bin/packer validate shibboleth-appliance.json'

stage 'Build Appliance'

sh '/usr/local/bin/packer build shibboleth-appliance.json'

}
64 changes: 18 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Introduction

This packer templates create vmware image of CentOS 7 with `.vmx` and `.ova`. In addition, there is an AMI you can create for AWS. You will need to have credentials setup according to [AWS credentials setup](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)
This packer templates create vmware image of CentOS 7 with `.box` and `.ova`. In addition, there is an AMI you can create for AWS. You will need to have credentials setup according to [AWS credentials setup](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)

The OS versions are:

Expand All @@ -11,12 +11,14 @@ The OS versions are:
For all operating systems we generate images for

- centos7.json will build:
- VmWare (user: packer/changeme1234)
- VirtualBox (user: packer/changeme1234)

- aws-centos7-base.json will build:
- AMI for AWS (user: centos/centos)

- sibboleth-appliance.json will build:
- VirtualBox (user: centos/centos)

This template only is tested against 64 bit systems. With the following sizing requirements:
```
"vmx_data": {
Expand All @@ -34,6 +36,16 @@ This template only is tested against 64 bit systems. With the following sizing r

The templates are only tested with [packer](http://www.packer.io/downloads.html) 0.10.1 and later.

For local builds, you will need to provide a symbolic link to the `ansible-playbooks` directory for matching repo location. Make sure you have cloned and setup the [ansible-playbooks repo](https://github.internet2.edu/docker/ansible-playbooks).

```
# example
ln -s /path/to/ansible-playbooks ansible-playbooks
# specific setup
ln -s ../ansible-playbooks ansible-playbooks
```

### Pre-Requisites for AWS / AMI import

- IAM needs to be setup for the `vmimport` role per the [AWS guide](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/VMImportPrerequisites.html#vmimport-service-role).
Expand All @@ -56,53 +68,12 @@ AMI build will require both `aws_access_key` and `aws_secret_key` to be setup wi
packer build aws-centos7-base.json
```
## Issues during build time
If you experience issues with packer, please use `PACKER_LOG=1 packer ... ` to find the errors.
## Author
- Author:: Mason Packard (<mason.packard@levvel.io>)
# License
TBD
# Packer Image Builder for CentOS
## Introduction
This packer templates create vmware image of CentOS 7 with `.vmx` file type.
The OS versions are:
- Centos 7
For all operating systems we generate images for
- VmWare (user: packer/changeme1234)
This template only is tested against 64 bit systems. With the following sizing requirements:
Shibboleth Appliance build for `.ova`, `.box`, and AWS ami
```
"vmx_data": {
"cpuid.coresPerSocket": "1",
"memsize": "512",
"numvcpus": "2"
}
# Build CentOS for ova, box, ami
packer build shibboleth-appliance.json
```
```
"disk_size": 81920
```
## Requirements
The templates are only tested with [packer](http://www.packer.io/downloads.html) 0.10.1 and later.
## Run conversion process
# Build CentOS VMWare image
PACKER_LOG=1 packer build centos7.json
## Issues during build time
If you experience issues with packer, please use `PACKER_LOG=1 packer ... ` to find the errors.
Expand All @@ -114,3 +85,4 @@ If you experience issues with packer, please use `PACKER_LOG=1 packer ... ` to f
# License
TBD
8 changes: 0 additions & 8 deletions ansible/main.yml

This file was deleted.

2 changes: 2 additions & 0 deletions http/ks-ext4.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ mkdir --mode=700 /home/centos/.ssh
cat << EOF > /home/centos/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0F2Y68rs0DPofa9ZCJYxx9FG6Lzk+szeI6/c2P4C3yNWy1QvPDfUzFXGgPnb/O0EkI6s4qQ8Nt16GAfwdC4xvrZG5lpn++vBwEb4CxpF+23TsmQCi+DJjNgH4+XfBlGqplcjxJuMOrKrOO+wGuc7yetJ32b2wMNJUv0ijWpCiFp8fhs0a5+q4tq+6Q7LBlaIFTvjTP+YKh7JxAzG492m8TkbVQGnPpnTFI5OF5Q6t0Yqn87RZvVRvuU+jXXxSH7EHWbSpkXveElCC53o3MtunwTYtSkGDkAIF92Iw7eEX9d6hVsO4OXZPIgZn0oWNQQh8yyDYHB+4XQa1mQD8TS8f centos@centos.local

chown -R centos /home/centos/.ssh

EOF

yum -y update
Expand Down
1 change: 0 additions & 1 deletion http/ks-xfs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ reboot
@core
@development Tools
openssh-clients
sudo
openssl-devel
readline-devel
zlib-devel
Expand Down
82 changes: 82 additions & 0 deletions shibboleth-appliance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"min_packer_version": "0.8.6",
"description": "Shibboleth appliance ",
"variables": {
"profile": "xfs",
"disk_size": "8192",
"memory": "6122",
"cpus": "2",
"ssh_username": "centos",
"ssh_password": "centos",
"region": "us-west-1",
"timestamper": "{{timestamp}}",
"outputfile_name": "shibboleth-appliance-centos7"
},
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'centos' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/ansible.sh"
},
{
"type": "ansible-local",
"playbook_dir": "ansible-playbooks",
"playbook_file": "ansible-playbooks/shibboleth-appliance-vbox.yml"
},
{
"type": "shell",
"execute_command": "echo 'centos' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/cleanup.sh"
}
],
"builders": [
{
"type": "virtualbox-iso",
"name": "shibboleth-appliance-centos7",
"vm_name": "shibboleth-appliance-centos7-{{user `profile`}}",
"headless": true,
"guest_os_type": "RedHat_64",
"disk_size": "{{user `disk_size`}}",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "{{user `memory`}}"],
["modifyvm", "{{.Name}}", "--cpus", "{{user `cpus`}}"]
],
"iso_url": "http://mirror.vcu.edu/pub/gnu+linux/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso",
"iso_checksum": "f90e4d28fa377669b2db16cbcb451fcb9a89d2460e3645993e30e137ac37d284",
"iso_checksum_type": "sha256",
"http_directory": "http",
"boot_command": ["<tab> text ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks-{{user `profile`}}.cfg<enter><wait>"],
"boot_wait": "10s",
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"guest_additions_mode": "disable",
"shutdown_command": "sudo -S shutdown -P now",
"output_directory": "output-{{user `profile`}}",
"format": "ova"
}
],
"post-processors": [
{
"type": "compress",
"compression_level": "9",
"output": "builds/{{user `outputfile_name`}}-ova-{{user `timestamper`}}.tar"
},
{
"type": "vagrant",
"compression_level": "9",
"output": "builds/{{user `outputfile_name`}}-vagrant-{{user `timestamper`}}.box"
},
{
"type": "amazon-import",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "{{user `region`}}",
"s3_bucket_name": "internet2-ami-import-us-west-1",
"tags": {
"Description": "packer amazon-import-shibboleth-appliance {{user `timestamper`}}"
}
}
]
}

0 comments on commit 941eb09

Please sign in to comment.