ansible - 如何在具有 python 2.4 的远程服务器上进行 ansible 工作
问题描述
让我的问题更有意义...
Ansible 控制器服务器:ansible 2.4.2.0 Python 2.7.5
托管节点名 (goldville):Python 2.4.2
当我运行 #ansible goldville -m ping 时,出现以下错误
文件 "/tmp/ansible_RSjze6/ansible_module_ping.py",第 8 行\r\n from future import absolute_import, division, print_function\r\nSyntaxError: future feature absolute_import is not defined\r\n"
我如何使用这个节点和 python 2.4.2 从控制器运行剧本。
解决方案
如果您想在某些主机或组中使用 python 2.4,请设置ansible_python_interpreter
库存变量,请尝试以下操作:
[py24-hosts]
goldville-py3 ansible_host=goldville
[py24-hosts:vars]
ansible_python_interpreter=/usr/bin64/python2.4
但是如果你想全部使用 python2.4,你必须在配置文件interpreter_python
的部分中设置 keydefaults
ansible.cfg
文档: https ://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html
推荐阅读
- powershell - 仅需要和测试命名参数
- amazon-web-services - docker-machine 和 kubernetes
- python - 如何在获取结果之前获取与 sqlalchemy 结果代理对象关联的结果数量?
- node.js - /bin/sh: 1: node_modules/.bin/nodemon: 未找到
- javascript - 未找到模块:无法解析 'F:\CFC\aaa\src\components\Login' 中的 'react-bootstrap/Panel'
- powershell - 从脚本运行时格式意外更改
- django - 如何在 django 的表单操作中发送选定的选项值
- jenkins - Run Jenkinsfile with hardcoded parameters
- android - 删除短信和阅读通话记录权限后,我仍然收到 Google 警告
- angular - How to unit test 'navigate' with Query Params in Angular?