标签:
如果你想使用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