Last active
May 16, 2016 08:58
-
-
Save oli-logicnow/4fe9987bbb53a92e9ce0aa4b8e90f3e7 to your computer and use it in GitHub Desktop.
SSH connection being closed when cutting an AMI using ec2_ami for Ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I had problems with periodically getting "SSH Error: Shared connection to 52.49.192.253 closed" when cutting an AMI from an instance I'd created. | |
Because the default action of ec2_ami is to reboot the instance before creating the AMI, Ansible was loosing the connection. | |
The solution: set no_reboot to "yes" http://docs.ansible.com/ansible/ec2_ami_module.html | |
- name: Cut AMI | |
ec2_ami: | |
region: "{{ aws_region }}" | |
aws_region: "{{ aws_region }}" | |
aws_access_key: "{{ aws_access_key }}" | |
aws_secret_key: "{{ aws_secret_key }}" | |
aws_region: "{{ aws_region }}" | |
instance_id: "{{ instance_od }}" | |
name: "example - {{ ansible_date_time.epoch }}" | |
wait: yes | |
no_reboot: yes | |
register: ami |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment