Ansible Provisioner for Aminator

Hard Drive Platters

Aminator lets you bake an Amazon Machine Image (AMI) using a variety of provisioners including apt and yum. Now there is also an Ansible Provisioner. The PR for this should be merged in shortly. This means you can use your favorite Ansible playbook to configure a running instance, or to build an AMI.

Aminator works by taking an existing AMI (called a Foundation AMI), getting the snapshot it is backed by, and creating an EBS volume from it. With that volume attached, it can then run scripts and install programs in a chroot environment. This is basically the process Eric Hammond has been using for years to make public AMIs securely.

The only requirement for using the Ansible Provisioner is for the Foundation AMI to have Ansible installed already. To save you time, I have created Foundation AMI for Ubuntu 12.04 LTS available in all AWS regions. You can find the list here:

https://github.com/Answers4AWS/netflixoss-ansible/wiki/Foundation-AMIs-for-Aminator

Get started with Aminator - the easy way

Getting up and running with Aminator is now easier thanks to a CloudFormation script that does all the tedious stuff for you (creating a security group, an IAM role, an ASG, and the instance). If you have the AWS CLI tools installed, you can launch Aminator by doing this:

$ aws cloudformation create-stack  \
 --stack-name Aminator  \
 --template-url https://answers4aws.s3.amazonaws.com/aminator.json  \
 --parameters ParameterKey=InstanceType,ParameterValue=t1.micro,ParameterKey=KeyName,ParameterValue=mykey

NOTE: mykey is the name of the KeyPair you want to use to SSH to the instance.

Once the CloudFormation script has complete, you can find the EC2 instance by running:

$ aws cloudformation describe-stacks
    ...
            "StackName": "Aminator",
            "StackStatus": "CREATE_COMPLETE",

$ aws ec2 describe-instances --filters Name=tag:Name,Values=Aminator | grep "PublicDnsName"
                    "PublicDnsName": "ec2-12-12-12-12.compute.amazonaws.com",

and then SSH to it:

$ ssh -i /path/to/mykey.pem ubuntu@ec2-12-12-12-12.compute.amazonaws.com

This particular instance comes with the NetflixOSS-Ansible playbooks already installed, which means you can make your own Asgard, Eureka, Edda or Aminator AMIs. To create an Asgard AMI:

$ sudo aminate -e ec2_ansible_linux -B ami-6637760f asgard-ubuntu.yml

At the end of this, you will have your very own Asgard AMI.

As always, please send any feedback you have, and feel free to fork and modify any of this to suit your own needs.

Happy Aminating!

comments powered by Disqus