如何解决Ansible Tower - aws_s3 模块 - 设置 python 解释器并安装依赖项
我正在尝试通过 Ansible AWX(塔式)部署以下任务,并且在使用 aws_s3 模块时遇到了一些问题。
---
- hosts: all
become: yes
tasks:
- name: Setting host facts for Python interpreter
set_fact:
ansible_python_interpreter: "/usr/bin/python3"
- name: 01 - Download file locally
aws_s3:
bucket: temp-buck-0001
object: /test/quiz.sh
dest: /tmp/quiz.sh
mode: get
- name: 02 - Change the file permissions of the shell scrip to allow for execute
file:
path: /tmp/quiz.sh
mode: "u=x"
- name: 03 - Change the working directory to tmp before executing the command.
shell: quiz.sh >> quizlog.txt
args:
chdir: /tmp
尝试部署上述 ansible play 时出现以下错误。 Python 依赖项似乎存在问题,尤其是 boto3 和 botocore,因此我尝试手动安装它们以进行测试。
但是,我收到以下错误。它涉及 aws_s3 模块的依赖项。我不确定我是否正确设置了我的 Python 解释器。任何帮助将不胜感激。
另外,如果有人可以建议如何编写一个任务来安装 aws_s3 模块所需的 Python3x 和依赖项,那也将不胜感激。
任务 [01 - 在本地下载 Metricbeats 文件] ********************************** 致命:[Dev-02]:失败! => {"changed": false,"module_stderr": "共享连接到 20.10.12.114 已关闭。\r\n","module_stdout": "/bin/sh: /usr/bin/python3: 没有这样的 文件或目录\r\n","msg": "模块执行失败 正确,您可能需要设置解释器。\n请参阅 确切错误的标准输出/标准错误","rc": 127}
和下面的输出
{ "module_stdout": "/bin/sh: /usr/bin/python3: 没有那个文件或 directory\r\n","module_stderr": "到 20.10.12.114 的共享连接 已关闭。\r\n","msg": "模块未能正确执行,您 可能需要设置解释器。\n有关确切的信息,请参阅 stdout/stderr 错误","rc": 127,"_ansible_no_log": false,"changed": false }
对于上下文,这是我安装的 Python 版本:
[ec2-user@ip-20-10-12-114 ~]$ pip --version
pip 21.0.1 from /usr/lib/python3.6/site-packages/pip (python 3.6)
[ec2-user@ip-20-10-12-114 ~]$ which pip
/usr/bin/pip
[ec2-user@ip-20-10-12-114 ~]$ python --version
Python 2.7.18
[ec2-user@ip-20-10-12-114 ~]$ which python
/usr/bin/python
[ec2-user@ip-20-10-12-114 ~]$ python3 --version
Python 3.6.2
[ec2-user@ip-20-10-12-114 ~]$ which python3
/usr/bin/python3
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。