From dd0061d810873f93a474d16f9721ce3df34f6182 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Thu, 18 Aug 2016 18:07:25 -0400 Subject: [PATCH 01/41] Make sure that user owns the ssh directory and keys. --- http/ks-ext4.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http/ks-ext4.cfg b/http/ks-ext4.cfg index c28f769..eb813e2 100644 --- a/http/ks-ext4.cfg +++ b/http/ks-ext4.cfg @@ -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 From 965a875c738cbdc5d50aacfd3890ba13b6e127ea Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 10:31:57 -0400 Subject: [PATCH 02/41] Add information for the shibboleth specific virtual box build. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3e8916f..ea90bf4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,9 @@ For all operating systems we generate images for - aws-centos7-base.json will build: - AMI for AWS (user: centos/centos) +- sibboleth-appliance-vbox.json will build: + - VirtualBox (user: centos/centos) + This template only is tested against 64 bit systems. With the following sizing requirements: ``` "vmx_data": { From 7b6671653e5e908248657de2a218d8ae3bdef84b Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 10:32:37 -0400 Subject: [PATCH 03/41] Cleanup double in the kickstart file. --- http/ks-xfs.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/http/ks-xfs.cfg b/http/ks-xfs.cfg index 6a1ae34..77c7449 100644 --- a/http/ks-xfs.cfg +++ b/http/ks-xfs.cfg @@ -32,7 +32,6 @@ reboot @core @development Tools openssh-clients -sudo openssl-devel readline-devel zlib-devel From 8b99e80c041d7686d4b3fee40a318a909c3c4100 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 10:55:39 -0400 Subject: [PATCH 04/41] Basic setup for shibboleth appliance for compressed virtualbox. --- shibboleth-appliance-vbox.json | 64 ++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 shibboleth-appliance-vbox.json diff --git a/shibboleth-appliance-vbox.json b/shibboleth-appliance-vbox.json new file mode 100644 index 0000000..b4ea6be --- /dev/null +++ b/shibboleth-appliance-vbox.json @@ -0,0 +1,64 @@ +{ + "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" + }, + "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": [" text ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks-{{user `profile`}}.cfg"], + "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": [ + { + "output": "builds/shibboleth-appliance-centos7-vbox-{{timestamp}}.tar", + "type": "compress" + } + ] +} From 586e73c6447e831c2621bf4c064484aba678dbc9 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 13:22:43 -0400 Subject: [PATCH 05/41] Adjust Readme. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ea90bf4..a092103 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ 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: From 0e545d1d9818bcfb891f87c78dce6b2a944a783e Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 13:30:17 -0400 Subject: [PATCH 06/41] Add basic Jenkins pipeline. --- Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..66b1dd2 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,15 @@ +node('packer') { + + stage 'Checkout' + + # Get the packer-centos-7 repo + + checkout scm + + # Get the ansible-playbooks repo + + stage 'Validate' + + sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' + +} From af3dc4a4e864cf5df288fb05fc83f19483c52032 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 13:34:09 -0400 Subject: [PATCH 07/41] Fix syntax on jenkins pipeline. --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 66b1dd2..03dd4e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,14 @@ +#!groovy + node('packer') { stage 'Checkout' - # Get the packer-centos-7 repo + // Get the packer-centos-7 repo checkout scm - # Get the ansible-playbooks repo + // Get the ansible-playbooks repo stage 'Validate' From 514ac3b256910a40e8c070785c6fa55b690b1033 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 13:43:55 -0400 Subject: [PATCH 08/41] Change outfile format. --- shibboleth-appliance-vbox.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shibboleth-appliance-vbox.json b/shibboleth-appliance-vbox.json index b4ea6be..7d9f20e 100644 --- a/shibboleth-appliance-vbox.json +++ b/shibboleth-appliance-vbox.json @@ -8,7 +8,8 @@ "cpus": "2", "ssh_username": "centos", "ssh_password": "centos", - "region": "us-west-1" + "region": "us-west-1", + "outputfile_name": "shibboleth-appliance-centos7-vbox-{{timestamp}}.tar" }, "provisioners": [ { @@ -57,7 +58,7 @@ ], "post-processors": [ { - "output": "builds/shibboleth-appliance-centos7-vbox-{{timestamp}}.tar", + "output": "builds/{{user `outputfile_name`}}", "type": "compress" } ] From e8c7a4684cff9e1bb0323c92e1db3305d8a8c99a Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 13:45:17 -0400 Subject: [PATCH 09/41] Add pull ansible-playbooks repo. --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 03dd4e1..64af51a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,6 +10,8 @@ node('packer') { // Get the ansible-playbooks repo + git url: 'https://github.internet2.edu/docker/ansible-playbooks' + stage 'Validate' sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' From f362c7543315580b7c9e99834f13a9080994465e Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 13:48:15 -0400 Subject: [PATCH 10/41] Fix syntax --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 64af51a..8efc84f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ node('packer') { // Get the ansible-playbooks repo - git url: 'https://github.internet2.edu/docker/ansible-playbooks' + git url: 'https://github.internet2.edu/docker/ansible-playbooks.git' stage 'Validate' From 7d375cd53ca178ba94e7239e9d5375a4f1edda76 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 13:51:12 -0400 Subject: [PATCH 11/41] Change how ansible-playbooks gets to the worker. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8efc84f..d958bdd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ node('packer') { // Get the ansible-playbooks repo - git url: 'https://github.internet2.edu/docker/ansible-playbooks.git' + sh 'git clone https://github.internet2.edu/docker/ansible-playbooks.git' stage 'Validate' From 71c509f008273b6cc5cc29c6fa324c482934c5ec Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 14:55:51 -0400 Subject: [PATCH 12/41] Change to pull repo from git. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d958bdd..8efc84f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ node('packer') { // Get the ansible-playbooks repo - sh 'git clone https://github.internet2.edu/docker/ansible-playbooks.git' + git url: 'https://github.internet2.edu/docker/ansible-playbooks.git' stage 'Validate' From d541d0b098968c362ff32d709d7a2da33b518999 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 15:46:36 -0400 Subject: [PATCH 13/41] Setup git for ansible-playbooks. --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8efc84f..bfbe122 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,9 +8,10 @@ node('packer') { checkout scm - // Get the ansible-playbooks repo + stage 'Acquire ansible-playbooks' - git url: 'https://github.internet2.edu/docker/ansible-playbooks.git' + git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", + credentialsId: "jenkins-github-access-token" ]) stage 'Validate' From 5958e9b2c4974563d156beccf3905a82e17b28d2 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 15:50:25 -0400 Subject: [PATCH 14/41] Debug pipeline --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index bfbe122..ebe44b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,6 +15,7 @@ node('packer') { stage 'Validate' - sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' + sh 'ls' + sh '/usr/local/bin/packer validate ./shibboleth-appliance-vbox.json' } From ebd01e7e8f8a707881448ac9b6f1a3661a79f93c Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 15:52:42 -0400 Subject: [PATCH 15/41] Refactor order. --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ebe44b2..97fa5f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,17 +2,17 @@ node('packer') { + stage 'Acquire ansible-playbooks' + + git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", + credentialsId: "jenkins-github-access-token" ]) + stage 'Checkout' // Get the packer-centos-7 repo checkout scm - stage 'Acquire ansible-playbooks' - - git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", - credentialsId: "jenkins-github-access-token" ]) - stage 'Validate' sh 'ls' From 60aa59e520e0daaec446ca7b7c56b35828ab36be Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 15:55:23 -0400 Subject: [PATCH 16/41] Debug. --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 97fa5f6..1aa1ccb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,9 @@ node('packer') { git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", credentialsId: "jenkins-github-access-token" ]) + sh 'pwd' + sh 'ls' + stage 'Checkout' // Get the packer-centos-7 repo @@ -15,6 +18,7 @@ node('packer') { stage 'Validate' + sh 'pwd' sh 'ls' sh '/usr/local/bin/packer validate ./shibboleth-appliance-vbox.json' From 0ebd9f7d267787f9dcb98b97e088a8fe77b6e6ec Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:00:41 -0400 Subject: [PATCH 17/41] Ensure directory structure. --- Jenkinsfile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1aa1ccb..03e2c36 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,8 +4,11 @@ node('packer') { stage 'Acquire ansible-playbooks' - git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", - credentialsId: "jenkins-github-access-token" ]) + sh 'mkdir -p ansible-playbooks' + dir('ansible-plyabooks'){ + git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", + credentialsId: "jenkins-github-access-token" ]) + } sh 'pwd' sh 'ls' @@ -14,12 +17,16 @@ node('packer') { // Get the packer-centos-7 repo - checkout scm - - stage 'Validate' + sh 'mkdir -p packer-centos-7' + dir('packer-centos-7'){ + checkout scm + } sh 'pwd' sh 'ls' + + stage 'Validate' + sh '/usr/local/bin/packer validate ./shibboleth-appliance-vbox.json' } From 9dea0a420532d4459ec45a182c83d73c2bde98fe Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:03:55 -0400 Subject: [PATCH 18/41] Fix syntax --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03e2c36..795b46b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ node('packer') { stage 'Acquire ansible-playbooks' sh 'mkdir -p ansible-playbooks' - dir('ansible-plyabooks'){ + dir('ansible-playbooks'){ git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", credentialsId: "jenkins-github-access-token" ]) } From c78aa85ae826bec627a9346154ab5d3979337b2c Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:08:33 -0400 Subject: [PATCH 19/41] Adjust pipeline. --- Jenkinsfile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 795b46b..7dab0cd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,23 +4,17 @@ node('packer') { stage 'Acquire ansible-playbooks' - sh 'mkdir -p ansible-playbooks' - dir('ansible-playbooks'){ - git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", + git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", credentialsId: "jenkins-github-access-token" ]) - } - sh 'pwd' - sh 'ls' + sh 'pwd' + sh 'ls' stage 'Checkout' // Get the packer-centos-7 repo - sh 'mkdir -p packer-centos-7' - dir('packer-centos-7'){ - checkout scm - } + checkout scm sh 'pwd' sh 'ls' From 31a6c9bcf383e6047d34b55f2412676f71485d81 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:16:03 -0400 Subject: [PATCH 20/41] Working on pipeline. --- Jenkinsfile | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7dab0cd..be3b31e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,26 +1,17 @@ #!groovy node('packer') { + stage 'Checkout' + + checkout scm stage 'Acquire ansible-playbooks' git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", credentialsId: "jenkins-github-access-token" ]) - sh 'pwd' - sh 'ls' - - stage 'Checkout' - - // Get the packer-centos-7 repo - - checkout scm - - sh 'pwd' - sh 'ls' - stage 'Validate' - sh '/usr/local/bin/packer validate ./shibboleth-appliance-vbox.json' + sh '/usr/local/bin/packer validate ./packer-centos-7/shibboleth-appliance-vbox.json' } From 6cd30fa8cd527443abd8612b4ad3a91b071c5a00 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:18:01 -0400 Subject: [PATCH 21/41] Debug --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index be3b31e..051827a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,6 +12,8 @@ node('packer') { stage 'Validate' + sh 'pwd' + sh 'ls' sh '/usr/local/bin/packer validate ./packer-centos-7/shibboleth-appliance-vbox.json' } From 37269936eeae4c393a6145cbd6589da00c73893a Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:23:20 -0400 Subject: [PATCH 22/41] Debug --- Jenkinsfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 051827a..365863c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,10 @@ node('packer') { stage 'Checkout' - checkout scm + sh 'mkdir -p packer-centos-7' + dir('packer-centos-7'){ + checkout scm + } stage 'Acquire ansible-playbooks' @@ -12,8 +15,8 @@ node('packer') { stage 'Validate' + sh 'cd ../packer-centos-7' sh 'pwd' - sh 'ls' - sh '/usr/local/bin/packer validate ./packer-centos-7/shibboleth-appliance-vbox.json' + sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' } From c586b5d9b92a2aac9fb247ddc09409229989f2df Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:24:29 -0400 Subject: [PATCH 23/41] Debug --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 365863c..75ecd5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,8 @@ node('packer') { stage 'Validate' - sh 'cd ../packer-centos-7' + sh 'ls' + sh 'cd packer-centos-7' sh 'pwd' sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' From ba87f9cbc132ec02cb09750ed69240fa468b82a2 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:26:33 -0400 Subject: [PATCH 24/41] Debug --- Jenkinsfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 75ecd5d..15d4214 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,10 +3,7 @@ node('packer') { stage 'Checkout' - sh 'mkdir -p packer-centos-7' - dir('packer-centos-7'){ - checkout scm - } + checkout scm stage 'Acquire ansible-playbooks' From 24298d9e543a0bb57750769ffc8e18e26c4db9b6 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:29:11 -0400 Subject: [PATCH 25/41] Debug --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 15d4214..d8e2999 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,6 @@ node('packer') { stage 'Validate' sh 'ls' - sh 'cd packer-centos-7' sh 'pwd' sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' From 445d217ac0c31a766b1e669f1fcce5160d32df58 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:37:05 -0400 Subject: [PATCH 26/41] Debug, change dir structure. --- Jenkinsfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d8e2999..56d8d46 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,13 +7,16 @@ node('packer') { stage 'Acquire ansible-playbooks' - git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", + sh 'mkdir -p ansible-playbooks' + dir('ansible-playbooks'){ + git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", credentialsId: "jenkins-github-access-token" ]) + } + sh 'ls' + sh 'mv ansible-playbooks/* ./ansible-playbooks' stage 'Validate' - sh 'ls' - sh 'pwd' sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' } From ddfead890852930188355c2e7baea5b4a35a7e44 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:39:45 -0400 Subject: [PATCH 27/41] Debug --- Jenkinsfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 56d8d46..bdb7e8a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,13 +7,9 @@ node('packer') { stage 'Acquire ansible-playbooks' - sh 'mkdir -p ansible-playbooks' - dir('ansible-playbooks'){ - git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", + git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", credentialsId: "jenkins-github-access-token" ]) - } - sh 'ls' - sh 'mv ansible-playbooks/* ./ansible-playbooks' + stage 'Validate' From d603ffffe306c1013d8ed3e8e633f537991a7a28 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 16:55:30 -0400 Subject: [PATCH 28/41] Debug --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index bdb7e8a..f08bf3f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,4 +15,5 @@ node('packer') { sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' + } From 81a18e8dc3dd5327de576fc6f2e897fb4cba4cd6 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 17:00:28 -0400 Subject: [PATCH 29/41] Remove Jenkins for now --- Jenkinsfile | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index f08bf3f..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,19 +0,0 @@ -#!groovy - -node('packer') { - stage 'Checkout' - - checkout scm - - stage 'Acquire ansible-playbooks' - - git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", - credentialsId: "jenkins-github-access-token" ]) - - - stage 'Validate' - - sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' - - -} From 00438ace2d60f72ddbaf638cc88ffbf3b1150172 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 17:02:27 -0400 Subject: [PATCH 30/41] Add back Jenkinsfile --- Jenkinsfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..f08bf3f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,19 @@ +#!groovy + +node('packer') { + stage 'Checkout' + + checkout scm + + stage 'Acquire ansible-playbooks' + + git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", + credentialsId: "jenkins-github-access-token" ]) + + + stage 'Validate' + + sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' + + +} From 5820a543c58e98c00262f2a1a4432b79c2c60404 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 17:08:53 -0400 Subject: [PATCH 31/41] Setup for dir structure --- Jenkinsfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f08bf3f..18f1219 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,13 +7,22 @@ node('packer') { stage 'Acquire ansible-playbooks' + sh 'mkdir -p ansible-playbooks' + dir('ansible-playbooks'){ git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", credentialsId: "jenkins-github-access-token" ]) + } + stage 'Acquire packer-centos-7' - stage 'Validate' + sh 'mkdir -p packer-centos-7' + dir('packer-centos-7'){ + git([ url: "https://github.internet2.edu/docker/packer-centos-7.git", + credentialsId: "jenkins-github-access-token" ]) + } - sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' + stage 'Validate' + sh '/usr/local/bin/packer validate packer-centos-7/shibboleth-appliance-vbox.json' } From 5f25cff27bb8a7bc18735f5f3bb52cff662eaedf Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 17:28:35 -0400 Subject: [PATCH 32/41] Try one more time. --- Jenkinsfile | 10 +--------- shibboleth-appliance-vbox.json | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 18f1219..67bf370 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,16 +13,8 @@ node('packer') { credentialsId: "jenkins-github-access-token" ]) } - stage 'Acquire packer-centos-7' - - sh 'mkdir -p packer-centos-7' - dir('packer-centos-7'){ - git([ url: "https://github.internet2.edu/docker/packer-centos-7.git", - credentialsId: "jenkins-github-access-token" ]) - } - stage 'Validate' - sh '/usr/local/bin/packer validate packer-centos-7/shibboleth-appliance-vbox.json' + sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' } diff --git a/shibboleth-appliance-vbox.json b/shibboleth-appliance-vbox.json index 7d9f20e..a5fead0 100644 --- a/shibboleth-appliance-vbox.json +++ b/shibboleth-appliance-vbox.json @@ -19,8 +19,8 @@ }, { "type": "ansible-local", - "playbook_dir": "../ansible-playbooks", - "playbook_file": "../ansible-playbooks/shibboleth-appliance-vbox.yml" + "playbook_dir": "ansible-playbooks", + "playbook_file": "ansible-playbooks/shibboleth-appliance-vbox.yml" }, { "type": "shell", From fb61206ab20527b648d75c2469ef610f9017e45b Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Fri, 19 Aug 2016 17:33:44 -0400 Subject: [PATCH 33/41] Try one more another one. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 67bf370..df264d0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ node('packer') { sh 'mkdir -p ansible-playbooks' dir('ansible-playbooks'){ git([ url: "https://github.internet2.edu/docker/ansible-playbooks.git", - credentialsId: "jenkins-github-access-token" ]) + branch: "shibboleth-production", credentialsId: "jenkins-github-access-token" ]) } stage 'Validate' From 803f50b80a06858bd54e84e28617897bb7a417ae Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Sat, 20 Aug 2016 10:49:59 -0400 Subject: [PATCH 34/41] Removing ansible dir infavor of ansible-playbooks dir, matching to repo. --- ansible/main.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 ansible/main.yml diff --git a/ansible/main.yml b/ansible/main.yml deleted file mode 100644 index 71290a2..0000000 --- a/ansible/main.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- hosts: all - become: yes - gather_facts: yes - - tasks: - - name: "Run the Playbook" - shell: echo "<-------~ Playbook Start ~---------->" From c696a804b3fb3823e35a7afc580b22c81f22394d Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Sat, 20 Aug 2016 10:55:20 -0400 Subject: [PATCH 35/41] Add symbolic link to the ansible-playbooks repo and add info to README. --- .gitignore | 1 + README.md | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index 42b40c5..0ce61cb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ output-virtualbox-iso/* builds/* output-xfs/* output-ext4/* +ansible-playbooks diff --git a/README.md b/README.md index a092103..3478015 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,15 @@ 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. +Your will need to provide a symbolic link to the `ansible-playbooks` directory for matching repo location. +``` +ln -s ../ansible-playbooks ansible-playbooks + +or + +ln -s /path/to/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). From a926308315126038dd08be32a4dccbf7d3748e08 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Sat, 20 Aug 2016 13:22:30 -0400 Subject: [PATCH 36/41] Build tar, vagrant , AWS --- ...nce-vbox.json => shibboleth-appliance.json | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) rename shibboleth-appliance-vbox.json => shibboleth-appliance.json (73%) diff --git a/shibboleth-appliance-vbox.json b/shibboleth-appliance.json similarity index 73% rename from shibboleth-appliance-vbox.json rename to shibboleth-appliance.json index a5fead0..7e17656 100644 --- a/shibboleth-appliance-vbox.json +++ b/shibboleth-appliance.json @@ -9,7 +9,8 @@ "ssh_username": "centos", "ssh_password": "centos", "region": "us-west-1", - "outputfile_name": "shibboleth-appliance-centos7-vbox-{{timestamp}}.tar" + "timestamper": "{{timestamp}}", + "outputfile_name": "shibboleth-appliance-centos7" }, "provisioners": [ { @@ -58,8 +59,24 @@ ], "post-processors": [ { - "output": "builds/{{user `outputfile_name`}}", - "type": "compress" + "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`}}" + } } ] } From 685edf74111eac86349c48312832f3e39ebf7fe1 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Sat, 20 Aug 2016 13:24:41 -0400 Subject: [PATCH 37/41] Adjust jenkinsfile for more generic shibboleth appliance build. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index df264d0..dc8ad6c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,6 +15,6 @@ node('packer') { stage 'Validate' - sh '/usr/local/bin/packer validate shibboleth-appliance-vbox.json' + sh '/usr/local/bin/packer validate shibboleth-appliance.json' } From 9c2f908ec5211a94e43301522aab7eb8a41bbf64 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Sat, 20 Aug 2016 13:26:27 -0400 Subject: [PATCH 38/41] Add build stage --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index dc8ad6c..89f9d8b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,4 +17,8 @@ node('packer') { sh '/usr/local/bin/packer validate shibboleth-appliance.json' + stage 'Build Appliance" + + sh '/usr/local/bin/packer packer build shibboleth-appliance.json' + } From fb503e1b2445ae7d642c7b7259293a5da18bc0f1 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Sat, 20 Aug 2016 13:27:20 -0400 Subject: [PATCH 39/41] Add build stage --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 89f9d8b..3e9b55f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ node('packer') { sh '/usr/local/bin/packer validate shibboleth-appliance.json' - stage 'Build Appliance" + stage 'Build Appliance' sh '/usr/local/bin/packer packer build shibboleth-appliance.json' From 8bfceffdc686542231b30ab2ccba5262081cc8f1 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Sat, 20 Aug 2016 13:28:18 -0400 Subject: [PATCH 40/41] Add build stage --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3e9b55f..3bafba2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,6 +19,6 @@ node('packer') { stage 'Build Appliance' - sh '/usr/local/bin/packer packer build shibboleth-appliance.json' + sh '/usr/local/bin/packer build shibboleth-appliance.json' } From 0e77e9b106ea09f73e0a65d57c2c39623c32bf46 Mon Sep 17 00:00:00 2001 From: Mason Packard Date: Sat, 20 Aug 2016 15:58:20 -0400 Subject: [PATCH 41/41] Update README. --- README.md | 63 +++++++++++-------------------------------------------- 1 file changed, 12 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 3478015..350d35f 100644 --- a/README.md +++ b/README.md @@ -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: @@ -16,7 +16,7 @@ For all operating systems we generate images for - aws-centos7-base.json will build: - AMI for AWS (user: centos/centos) -- sibboleth-appliance-vbox.json will build: +- sibboleth-appliance.json will build: - VirtualBox (user: centos/centos) This template only is tested against 64 bit systems. With the following sizing requirements: @@ -36,13 +36,14 @@ 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. -Your will need to provide a symbolic link to the `ansible-playbooks` directory for matching repo location. -``` -ln -s ../ansible-playbooks ansible-playbooks - -or +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 @@ -67,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 () - -# 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. @@ -125,3 +85,4 @@ If you experience issues with packer, please use `PACKER_LOG=1 packer ... ` to f # License TBD +