Skip to content

Commit

Permalink
Initial commit: build ITK
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Mullins committed Jan 6, 2015
0 parents commit 054d1b0
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 0 deletions.
30 changes: 30 additions & 0 deletions build-itk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
- name: Clone ITK
command: >
git clone git://itk.org/ITK.git
creates=ITK
#- name: Change into the right branch
# command: >
# git checkout a-specific-branch
# chdir=ITK

- name: Create the build directory
command: >
mkdir itk-build
creates=itk-build
- name: Configure ITK
command: >
cmake ../ITK
chdir=itk-build
- name: Build ITK
command: >
make
chdir=itk-build
- name: Submit a dashboard
command: >
ctest -d Experimental
chdir=itk-build
15 changes: 15 additions & 0 deletions install-cmake-3.0.2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Grab cmake
command: >
wget http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz
creates=cmake-3.0.2.tar.gz
- name: Unpack cmake
command: >
tar xzf cmake-3.0.2.tar.gz
creates=cmake-3.0.2
- name: Install cmake
shell: >
./bootstrap; make; make install
chdir=cmake-3.0.2
15 changes: 15 additions & 0 deletions install-essentials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

This comment has been minimized.

Copy link
@mgrauer

mgrauer Jan 20, 2015

@chrismullins something in this form might be a bit more efficient and compact. Though you should double check that it actually works 😁

name: Install build essentials
sudo: yes
apt: name={{ item }} state=present update_cache=yes
with_items:
  -git
  -gcc
  -g++
  -make
  -vim

also, why do you need vim to build?

- name: Install git
apt: pkg=git update_cache=yes

- name: Install gcc
apt: pkg=gcc

- name: Install g++
apt: pkg=g++

- name: Install make
apt: pkg=make

- name: Install vim so you can edit things
apt: pkg=vim
2 changes: 2 additions & 0 deletions localhost
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[local]
localhost
85 changes: 85 additions & 0 deletions playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Use the ec2 module to create a new host and then add
# it to a special "ec2hosts" group.
- hosts: localhost
connection: local
gather_facts: False
vars:
ec2_access_key: "ANALPHANUMERICSTRING"
ec2_secret_key: "l3didyoureallythinkIwouldpostthisone+C0T3"
keypair: "my_key_name"
instance_type: "m3.medium"
# http://cloud-images.ubuntu.com/releases/14.04/release/
image: "ami-8caa1ce4"
group: "default"
region: "us-east-1"
zone: "us-east-1d"
tasks:
- name: make one instance
ec2: image={{ image }}
instance_type={{ instance_type }}
aws_access_key={{ ec2_access_key }}
aws_secret_key={{ ec2_secret_key }}
keypair={{ keypair }}
instance_tags='{"dashboard":"meshkit"}'
region={{ region }}
group={{ group }}
wait=true
register: ec2_info
- debug: var=ec2_info
- debug: var=item
with_items: ec2_info.instance_ids
- add_host: hostname={{ item.public_ip }} groupname=ec2hosts
with_items: ec2_info.instances
- name: wait for instances to listen on port:22
wait_for:
state=started
host={{ item.public_dns_name }}
port=22
with_items: ec2_info.instances

# Connect to the node and gather facts,
# including the instance-id. These facts
# are added to inventory hostvars for the
# duration of the playbook's execution
# Typical "provisioning" tasks would go in
# this playbook.
- hosts: ec2hosts
gather_facts: True
user: ubuntu
sudo: True
tasks:
# fetch instance data from the metadata servers in ec2
- ec2_facts:
# show all known facts for this host
- debug: var=hostvars[inventory_hostname]
# just show the instance-id
- debug: msg="{{ hostvars[inventory_hostname]['ansible_ec2_instance_id'] }}"

- hosts: ec2hosts
sudo: True
user: ubuntu
tasks:
- include: install-essentials.yml
- include: install-cmake-3.0.2.yml
- include: build-itk.yml


# Using the instanceid, call the ec2 module
# locally to remove the instance by declaring
# its state is "absent"
- hosts: ec2hosts
gather_facts: True
connection: local
vars:
ec2_access_key: "ANALPHANUMERICSTRING"
ec2_secret_key: "l3didyoureallythinkIwouldpostthisone+C0T3"
region: "us-east-1"
tasks:
- name: destroy all instances
ec2: state='absent'
aws_access_key={{ ec2_access_key }}
aws_secret_key={{ ec2_secret_key }}
region={{ region }}
instance_ids={{ item }}
wait=true
with_items: hostvars[inventory_hostname]['ansible_ec2_instance_id']

0 comments on commit 054d1b0

Please sign in to comment.