当使用Ansible配合云构造的时候,Ansible通常使用一个工具像 Packer 来构建镜像,CloudFormation 运行这些镜像, 或者通过用户数据,一旦镜像上线,ansible会被激发.(When using Ansible with CloudFormation, typically Ansible will be used with a tool like Packer to build images, and CloudFormation will launch those images, or ansible will be invoked through user data once the image comes online, or a combination of the two.)
请阅读ansible云构造的例子获取更多的细节.
使用Ansible 构造AWS镜像
Many users may want to have images boot to a more complete configuration rather than configuring them entirely after instantiation. To do this, one of many programs can be used with Ansible playbooks to define and upload a base image, which will then get its own AMI ID for usage with the ec2 module or other Ansible AWS modules such as ec2_asg or the cloudformation module. Possible tools include Packer, aminator, and Ansible’s ec2_ami module.
许多用户想去开机启动更完整的配置而不是安装之后配置.为了这样做,许多程序可以用于ansible playbook定义和上传基本的镜像,这让他们使用 ec2 模块后得到自己的AMI ID,或者其它的Ansible AWS模块例如ec2_asg 或者cloudformation 模块.可能的工具包含 Packer,aminator,和Ansible’s ec2_ami 模块
总的来说,我们发现许多用户使用Packer
Ansible Packer的文档可以在这里找到 https://www.packer.io/docs/provisioners/ansible-local.html.
如果你想采用Packer这时,配置一个基本的镜像使用Ansible在规则之后是可以接受的.
下一步:探索模块
Ansible附带许多模块来配置许多EC2服务.浏览 模块的 “Cloud” 目录查看完整的列表
See also
模块相关 All the documentation for Ansible modules Playbooks An introduction to playbooks 委托,滚动更新,本地动作 Delegation, useful for working with loud balancers, clouds, and locally executed steps. User Mailing List Have a question? Stop by the google group! irc.freenode.net #ansible IRC chat channel