捕获AMI后,/ usr / local / bin中的零字节文件

时间:2014-01-31 22:36:51

标签: amazon-web-services amazon-ec2 ami ansible

我正在使用Ansible启动EC2实例并捕获AMI图像。我已经验证这些依赖项是在实例上正确安装的。例如,这就是我在AMI成像之前在EC2实例上得到的结果:

ubuntu@ip-1-2-3-4:/usr/local/bin$ ansible --version
ansible 1.4.4

-rwxr-xr-x 1 root root  5907 Jan 31 22:20 ansible
-rwxr-xr-x 1 root root  9269 Jan 31 22:20 ansible-doc
-rwxr-xr-x 1 root root 29163 Jan 31 22:20 ansible-galaxy
-rwxr-xr-x 1 root root 10419 Jan 31 22:20 ansible-playbook
-rwxr-xr-x 1 root root  6916 Jan 31 22:20 ansible-pull
-rwxr-xr-x 1 root root   714 Jan 31 22:19 aws
-rwxr-xr-x 1 root root  1408 Jan 31 22:19 aws.cmd
-rwxr-xr-x 1 root root   897 Jan 31 22:19 aws_completer
-rwxr-xr-x 1 root root  1860 Jan 31 22:19 aws_zsh_completer.sh

问题是,一旦我捕获了AMI并启动了一个新实例,/usr/local/bin中的所有文件都是零字节文件!

-rwxr-xr-x 1 root root 0 Jan 31 22:20 ansible
-rwxr-xr-x 1 root root 0 Jan 31 22:20 ansible-doc
-rwxr-xr-x 1 root root 0 Jan 31 22:20 ansible-galaxy
-rwxr-xr-x 1 root root 0 Jan 31 22:20 ansible-playbook
-rwxr-xr-x 1 root root 0 Jan 31 22:20 ansible-pull
-rwxr-xr-x 1 root root 0 Jan 31 22:19 aws
-rwxr-xr-x 1 root root 0 Jan 31 22:19 aws.cmd
-rwxr-xr-x 1 root root 0 Jan 31 22:19 aws_completer
-rwxr-xr-x 1 root root 0 Jan 31 22:19 aws_zsh_completer.sh

当我从AMI创建新实例时,为什么这些文件为零?

1 个答案:

答案 0 :(得分:0)

这是Ansible的问题,而不是AWS。事实证明Ansible 1.4.4中有一个documentation bug,其中ec2_ami模块没有关闭并默认重启实例(文档声称它确实!)。这会导致文件系统完整性出现各种问题。

修复是在Ansible任务中包含no_reboot: no