My Bake Fails

The device is busy

Cause: There is a service left running at the end of your Ansible Playbook.

In order to unmount the EBS Volume your AMI is being created on, you need to make sure there are no services left running. NTP is a good example of a package that when installed, automatically starts running. Apache web server is another.

When installing these, you need to explicitly stop using Ansible's service module so you end up with a clean AMI.

Peter says: I like to write my playbooks to be flexible enough to run on live instances, as well as make AMIs. I do this by having 3 tasks for each service:

  • one to make sure it starts on boot
  • one to make sure it is started on a live server, and
  • one to make sure it is stopped when building an AMI

Here is an example:

- name: Install NTP (apt version)
  apt: pkg=ntp state=latest
  when: ansible_distribution == 'Ubuntu'

- name: Always start NTP service on boot
  service: name=ntp enabled=yes

- name: Starting NTP
  service: name=ntp state=started
  when: not ami

- name: Stopping NTP
  service: name=ntp state=stopped
  when: ami

Could not clone Git repository

Cause: Either a networking issue, or you have not added the Deploy Key to the repository.

In your AWS Account, the Baker will clone your Git repository (the one containing your Ansible playbooks) using the Deploy Key that was generated when you added your repository to the Bakery.

  1. Sign in to the Bakery
  2. Go back to Git Repository
  3. Copy the Deploy Key that was generated
  4. Add it to your Git Repository's settings
  5. Retry baking the AMI

My Deployment Fails

Access Denied

Cause: The Bakery Role has an old/incorrect IAM policy

Earlier versions of the Bakery had a different set of IAM permissions, than is required for deployment now. To fix:

  1. Sign in to the Bakery
  2. Go to your AWS Account and click Edit
  3. Copy the IAM policy
  4. Sign in to the AWS Web Console
  5. Go to the Bakery IAM Role
  6. Paste in the updated the policy and save it
What do you think of this page? Tell us about it