使用ansible从aws快照恢复实例
Restore Instance from aws snapshot using ansible
我拍了实例快照。我只想使用 ansible 恢复它。
请提供任何解决方案,我的ansible版本是1.9.4。
您可以使用 ec2_vol
模块:
http://docs.ansible.com/ansible/ec2_vol_module.html
注意:请留意它支持的选项以及添加它们的版本。
- name: Detach the old volume
ec2_vol:
region: "{{ aws_region }}"
id: "{{ get_id.volume_id }}"
instance: None
register: detach_vol
- name: Creating a Volume from a snapshot
ec2_vol:
snapshot: "{{snap_id}}"
region: "{{ aws_region }}"
volume_size: 40
instance: "{{ instance_id }}"
register: ec2_vol
tags: attach
- name: Attach the Created volume to an instance
ec2_vol:
instance: "{{ instance_id }}"
id: "{{ ec2_vol.volume_id }}"
device_name: /dev/sda1
delete_on_termination: yes
我拍了实例快照。我只想使用 ansible 恢复它。 请提供任何解决方案,我的ansible版本是1.9.4。
您可以使用 ec2_vol
模块:
http://docs.ansible.com/ansible/ec2_vol_module.html
注意:请留意它支持的选项以及添加它们的版本。
- name: Detach the old volume
ec2_vol:
region: "{{ aws_region }}"
id: "{{ get_id.volume_id }}"
instance: None
register: detach_vol
- name: Creating a Volume from a snapshot
ec2_vol:
snapshot: "{{snap_id}}"
region: "{{ aws_region }}"
volume_size: 40
instance: "{{ instance_id }}"
register: ec2_vol
tags: attach
- name: Attach the Created volume to an instance
ec2_vol:
instance: "{{ instance_id }}"
id: "{{ ec2_vol.volume_id }}"
device_name: /dev/sda1
delete_on_termination: yes