2016-01-23 89 views
1

從mac os x創建aws vpc時出現問題,但是完全相同的命令/角色正在從ubuntu運行。在Mac OS X上使用ansible進行AWS vpc創建

,我已經採取了在Mac OS X操作步驟:使用NTP

  • 升級ansible到第2版
  • 降級ansible到1.9.1,1.9.2版本

    • 更新時間,1.9.3和1.9.4
    • 博託版本是2.38.0

    隨着上述所有的變化,我收到此錯誤:

    PLAY *************************************************************************** 
    
    TASK [vpc : Creating an AWS VPC inside mentioned Region] *********************** 
    task path: /Users/arbab/ansible2/aws/roles/vpc/tasks/main.yml:2 
    ESTABLISH LOCAL CONNECTION FOR USER: xxxxxxxxx 
    127.0.0.1 EXEC (umask 22 && mkdir -p "$(echo $HOME/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196)" && echo "$(echo $HOME/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196)") 
    127.0.0.1 PUT /var/folders/rq/yhlwx3c971x6p88qwmvhpg600000gn/T/tmpoyL88U TO /Users/arbab/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196/ec2_vpc 
    127.0.0.1 EXEC LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /Users/arbab/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196/ec2_vpc; rm -rf "/Users/arbab/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196/" > /dev/null 2>&1 
    An exception occurred during task execution. The full traceback is: 
    Traceback (most recent call last): 
        File "/Users/arbab/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196/ec2_vpc", line 2867, in <module> 
        main() 
        File "/Users/arbab/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196/ec2_vpc", line 700, in main 
        (vpc_dict, new_vpc_id, subnets_changed, igw_id, changed) = create_vpc(module, vpc_conn) 
        File "/Users/arbab/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196/ec2_vpc", line 338, in create_vpc 
        previous_vpc = find_vpc(module, vpc_conn, id, cidr_block) 
        File "/Users/arbab/.ansible/tmp/ansible-tmp-1453191395.76-205801730631196/ec2_vpc", line 198, in find_vpc 
        previous_vpcs = vpc_conn.get_all_vpcs(None, {'cidr': cidr, 'state': 'available'}) 
        File "/Library/Python/2.7/site-packages/boto/vpc/__init__.py", line 111, in get_all_vpcs 
        return self.get_list('DescribeVpcs', params, [('item', VPC)]) 
        File "/Library/Python/2.7/site-packages/boto/connection.py", line 1186, in get_list 
        raise self.ResponseError(response.status, response.reason, body) 
    boto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized 
    <?xml version="1.0" encoding="UTF-8"?> 
    <Response><Errors><Error><Code>AuthFailure</Code><Message>AWS was not able to validate the provided access credentials</Message></Error></Errors><RequestID>2318e170-a400-499c-8713-4c0b3ec1850d</RequestID></Response> 
    
    fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "ec2_vpc"}, "parsed": false} 
    
    PLAY RECAP ********************************************************************* 
    127.0.0.1     : ok=0 changed=0 unreachable=0 failed=1 
    
  • +0

    你可以包含任務或引用角色(在github或galaxy中)? – Michael

    +0

    這個? https://github.com/arbabnazar/ansible-aws-vpc-ha-wordpress – Michael

    +0

    @Michael上面提到的鏈接是我的回購。這適用於Linux,但不適用於Mac OS X –

    回答

    1

    有一個未經授權的錯誤

    boto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized 
    

    你能否通過env命令檢查AWS憑證設置正確的錯誤?預期的名字是:

    export AWS_ACCESS_KEY_ID='AK123' 
    export AWS_SECRET_ACCESS_KEY='abc123' 
    
    +0

    謝謝@Javier Segura,這是舊的未使用憑據... env是一個提示 –