Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/344.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ansible“;ansible“python解释器”;错误_Python_Python 3.x_Ansible_Influxdb - Fatal编程技术网

Ansible“;ansible“python解释器”;错误

Ansible“;ansible“python解释器”;错误,python,python-3.x,ansible,influxdb,Python,Python 3.x,Ansible,Influxdb,我想用ansible安装XDB和配置。 文件复制和XDB配置正常 但创建数据库和用户创建部分会出现“ansible\u python\u解释器”错误 我搜索了这个错误并尝试了一些方法,但我自己无法解决这个问题 这是我的ansible主机文件 [loadbalancer] lb ansible_host=192.168.255.134 [loadbalancer:vars] ansible_python_interpreter="/usr/bin/python3"

我想用ansible安装XDB和配置。 文件复制和XDB配置正常 但创建数据库和用户创建部分会出现“ansible\u python\u解释器”错误

我搜索了这个错误并尝试了一些方法,但我自己无法解决这个问题

这是我的ansible主机文件

[loadbalancer]
lb      ansible_host=192.168.255.134

[loadbalancer:vars]
ansible_python_interpreter="/usr/bin/python3"
#ansible_python_interpreter="/usr/bin/env python"
#ansible_python_interpreter="/usr/libexec/platform-python"
这是我的yaml文件

# influxdb install and configuration

---
  - hosts: lb
    become: true
    tasks:
      - name: Copy Repo Files
        copy:
          src: ./files/influxdb.j2
          dest: /etc/yum.repos.d/influxdb.repo
          remote_src: no
      - name: Install Influxdb
        yum:
          name: influxdb
          state: latest
        notify:
             influxdb_ok
      - name: Crete Database
        community.general.influxdb_database:
          hostname: 192.168.255.134
          database_name: deneme
      - name: Create User
        community.general.influxdb_user:
          user_name: deneme_user
          user_password: deneme123

    handlers:
      - name: Start Influx Service
        service:
          name: influxdb
          state: started
          enabled: yes
        listen: influxdb_ok
我试图安装python3远程vm(lb)。 我试图更改解释器参数。 我试图用pip3安装请求模块

[root@centos8 influx]# ansible-playbook influxdb.yaml -K
BECOME password:

PLAY [lb] ***********************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************
ok: [lb]

TASK [Copy Repo Files] **********************************************************************************************
ok: [lb]

TASK [Install Influxdb] *********************************************************************************************
ok: [lb]

TASK [Crete Database] ***********************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'requests'
fatal: [lb]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (requests) on loadbalancer.servicepark.local's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}

PLAY RECAP **********************************************************************************************************
lb                         : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
我试图安装请求模块,目前为ansible版本

现在我的ansible机器版本

[root@centos8 influx]# python3 --version
Python 3.6.8
[root@centos8 influx]# ansible --version
ansible 2.10.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
lb虚拟机的版本

[root@loadbalancer ~]# influx --version
InfluxDB shell version: 1.8.2
[root@loadbalancer ~]# python3 --version
Python 3.6.8

缺少python模块(
请求
)。您应该运行pre_任务,以确保安装了所有必需的模块。@klaud。我现在加了,试了试,结果还是一样的。“-name:Install-pip-pip:name:requests”请注意,模块必须安装在目标(即
lb
)上,并使用正确的python版本(即3.6.8,而不是2.7,如果两者都已安装)。@Zeitounator它已安装。请求版本为2.24.0,并且只安装了python3,
/usr/bin/python3-m pip list
在该主机上返回什么?