我正在尝试执行playbook来停止ec2实例和其他playbook当我执行一个剧本我得到以下错误
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"aws_access_key": null, "aws_secret_key": null, "ec2_url": null, "key_material": null, "name": "ansible-sae", "profile": null, "region": "us-east-1", "security_token": null, "state": "present", "validate_certs": true, "wait": false, "wait_timeout": "300"}, "module_name": "ec2_key"}, "msg": "No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV4Handler'] Check your credentials"}
我已经在我的.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'
而剧本就像是
手册格式
- 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 回答
我正在通过git发现它是一个bug,似乎很多人都遇到了这个问题 . https://github.com/ansible/ansible/issues/10638