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