2

我正在主机 A 上运行一些游戏。

还有一些其他的游戏需要在主机 B(Ubuntu 16.04)上运行,但是只随 python3 一起提供,因此下面的任务

- name: db_config -> Create MY database
  mysql_db:
    ...create some db
  delegate_to: "{{ ec2_instance_ip }}"

失败:

失败:[localhost -> 33.99.123.88] => {"changed": false, "module_stderr": "与 33.99.123.88 的共享连接已关闭。\r\n", "module_stdout": "/bin/sh: 1: /usr/bin/python: 未找到\r\n", "msg": "MODULE FAILURE", "rc": 127}

如上所述,如何仅针对委派任务更改 python interpeter?

4

1 回答 1

8

只需添加ansible_python_interpreter到任务:

- name: db_config -> Create MY database
  mysql_db:
    ...create some db
  delegate_to: "{{ ec2_instance_ip }}"
  vars:
    ansible_python_interpreter: /path/to/python
于 2018-06-20T14:58:12.970 回答