连接到aw

时间:2016-06-14 17:22:33

标签: amazon-web-services amazon-ec2 ansible ansible-playbook aws-cli

我正在尝试执行playbook来停止ec2实例和其他剧本  当我执行一个剧本时,我得到以下错误

致命:[localhost]:失败! => {"更改":false,"失败":true,"调用":{" module_args":{" aws_access_key&#34 ;:null," aws_secret_key":null," ec2_url":null," key_material":null," name":" ansible-sae"," profile":null," region":" us-east-1"," security_token":null ,"陈述":"出现"," validate_certs":true,"等待":false," wait_timeout": " 300"}," module_name":" ec2_key"}," msg":"没有处理程序准备好进行身份验证。检查了1名处理程序。 [' HmacAuthV4Handler']检查您的凭据"}

我在我的.bashrc文件中添加了环境变量,但我仍然得到错误我的.bashrc文件,但是当我在playbook中包含aws访问密钥和密钥时,它执行时没有错误我有给予poweruser访问我提供的凭据,当我打开.bashrc时,我可以看到env变量,这意味着我已经保存了env。变量正确我无法理解为什么我得到这个错误

您可以看到aws acces密钥和秘密访问密钥变量:

# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging          
feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
export AWS_ACCESS_KEY_ID='XXXXXXXXXXXX'
export AWS_SECRET_ACCESS_KEY='XXXXXXXXXXXXXXX'

和剧本就像是

Playbook格式

 - hosts: local
   connection: local
   remote_user: ansible_user
   become: yes
   gather_facts: no
   tasks:
      - name: Create a new key pair
        ec2_key:
          name: ansible-sae
          region: us-east-1
          state: present

当我在playbook中使用相同的信用时,它可以正常工作

Ansible版本2.1.0.0,rhel 7.2(maipo)

1 个答案:

答案 0 :(得分:0)

我正在通过git发现它是一个bug,似乎很多人都遇到了这个问题。 https://github.com/ansible/ansible/issues/10638