Skip to content

Commit

Permalink
Merge branch 'master' into shibboleth-production
Browse files Browse the repository at this point in the history
  • Loading branch information
Mason Packard committed Aug 31, 2016
2 parents 38b7f57 + add05ff commit 0337cb0
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 48 deletions.
95 changes: 47 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,87 +2,86 @@

## Introduction

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)
In conjunction with the [ansible-playbooks](https://github.internet2.edu/docker/ansible-playbooks), these packer templates create the Shibboleth IdP, Grouper, and COmanage appliances for use by TIER members. These appliances are CentOS 7 with `.vmx` and `.ova` formats available. In addition, if your account has VMImport privileges on EC2, you can also create AMI for AWS purposes. 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:

- Centos 7
## Requirements

For all operating systems we generate images for
The templates are only tested with [packer](http://www.packer.io/downloads.html) 0.10.1 and later. If you have homebrew installed, `brew install packer` is effective.

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

- aws-centos7-base.json will build:
- AMI for AWS (user: centos/centos)
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). The `master` branch is acceptable for all developer test builds.

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

This template only is tested against 64 bit systems. With the following sizing requirements:
#### example
```
"vmx_data": {
"cpuid.coresPerSocket": "1",
"memsize": "512",
"numvcpus": "2"
}
ln -s /path/to/ansible-playbooks ansible-playbooks
```

##### common parent

If you have ansible-playbooks checked out in the same parent directory as this repository, this command will work.
```
"disk_size": 81920
ln -s ../ansible-playbooks ansible-playbooks
```

## Requirements
### 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).
- The bucket `internet2-ami-import-us-west-1` needs to be setup on AWS S3. (Alternatively, you can provide your own bucket name that you prefer.)


The templates are only tested with [packer](http://www.packer.io/downloads.html) 0.10.1 and later.
AMI build will require both `aws_access_key` and `aws_secret_key` to be setup with [AWS credentials setup](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)

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).

## Building
```
packer build shibboleth-appliance.json
```
# example
ln -s /path/to/ansible-playbooks ansible-playbooks

# specific setup
ln -s ../ansible-playbooks ansible-playbooks
If you encounter issues you don't understand, try this command:

```
PACKER_LOG packer build shibboleth-appliance.json
```

### Pre-Requisites for AWS / AMI import
Expect the build to take 30-45 minutes. If you are in position to watch the VirtualBox window, it can verify that progress is continuing during some times that the process appears to have hung.

- 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).
- The bucket `internet2-ami-import-us-west-1` needs to be setup on AWS S3.
## Author

- Author:: Mason Packard (<mason.packard@levvel.io>)

## Run conversion process
## Appendix

VMware and Virtualbox build
The OS versions are:

```
# Build CentOS VMWare and Virtualbox images
PACKER_LOG=1 packer build centos7.json
````
- Centos 7

AMI build will require both `aws_access_key` and `aws_secret_key` to be setup with [AWS credentials setup](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)
For all operating systems we generate images for

- centos7.json will build:
- 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:
```
# Build CentOS for AWS / AMI
packer build aws-centos7-base.json
"vmx_data": {
"cpuid.coresPerSocket": "1",
"memsize": "512",
"numvcpus": "2"
}
```

Shibboleth Appliance build for `.ova`, `.box`, and AWS ami
```
# Build CentOS for ova, box, ami
packer build shibboleth-appliance.json
"disk_size": 81920
```

## 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


51 changes: 51 additions & 0 deletions centos7-vbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/ansible.sh"
},
{
"type": "ansible-local",
"playbook_file": "ansible/main.yml"
},
{
"type": "shell",
"execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/cleanup.sh"
}
],
"builders": [
{
"type": "virtualbox-iso",
"name": "centos-7-vmx",
"boot_command": [
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
],
"boot_wait": "10s",
"disk_size": 81920,
"guest_os_type": "RedHat_64",
"headless": true,
"http_directory": "http",
"iso_urls": [
"CentOS-7-x86_64-Minimal-1511.iso",
"http://mirror.vcu.edu/pub/gnu+linux/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso"
],
"iso_checksum_type": "md5",
"iso_checksum": "88c0437f0a14c6e2c94426df9d43cd67",
"output_directory": "img-centos-7-vmware",
"ssh_username": "packer",
"ssh_password": "changeme1234",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo 'packer'|sudo -S /sbin/halt -h -p",
"vm_name": "packer-centos-7-x86_64"
}
],
"post-processors": [
{
"output": "builds/packer_centos7_{{.BuilderType}}.tar",
"type": "compress"
}
]
}

0 comments on commit 0337cb0

Please sign in to comment.