首页 > 其他 > 详细

ansible动态inventory里的针对AWS中国的设置

时间:2016-07-10 18:19:53      阅读:232      评论:0      收藏:0      [点我收藏+]

 如果你想使用ansible来动态管理AWS里的机器和设施,不幸的你用的是国内的AWS服务,你会发现一开始怎么用例子里的ec2.py都会报错说 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY 不对。

   博主研究了一下配置文件,发现缺省的ec2.ini文件里,竟然把中国区和美国政府专区给排除掉了。看起来,AWS的所有商业全球区域,也就是我中国区有此荣幸,被列为一个专区了。

# AWS regions to make calls to. Set this to ‘all‘ to make request to all regions
# in AWS and merge the results together. Alternatively, set this to a comma
# separated list of regions. E.g. ‘us-east-1,us-west-1,us-west-2‘
regions = all
regions_exclude = us-gov-west-1,cn-north-1

把 cn-north-1 从regions-exclude里去掉,ansible就可以访问如常了。如果想更快的拿到结果,直接把cn-north-1放到regions里指定就可以了。

# AWS regions to make calls to. Set this to ‘all‘ to make request to all regions
# in AWS and merge the results together. Alternatively, set this to a comma
# separated list of regions. E.g. ‘us-east-1,us-west-1,us-west-2‘
regions = cn-north-1
regions_exclude = us-gov-west-1

 

ansible动态inventory里的针对AWS中国的设置

原文:http://www.cnblogs.com/symbo/p/5658094.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!