zoukankan      html  css  js  c++  java
  • Ansible常见问题处理

    1、ansible all -m ping报错,信息如下:

    [WARNING]: log file at /var/log/ansible.log is not writeable and we cannot create it, aborting

    192.168.0.200 | UNREACHABLE! => {

        "changed": false,

        "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). ",

        "unreachable": true

    }

    解决方法:

    (1)权限问题造成的,在/etc/ansible/hosts 中配置如下信息

    192.168.0.200 ansible_user=root

    之前配置的只有192.168.0.200,没有后面的那个信息,然后造成这样的错误问题

    (2)在配置文件ansible.cfg中启用remote_user = root,则就不用再hosts文件中配置ansible_user=root了

    说明:ansible_user=root

    使用/usr/bin/ansible-playbook链接的默认用户名,如果不指定,会使用当前登录的用户名

    2、 "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"

    原因分析:托管节点上开启了SElinux,你需要安装libselinux-python,这样才可使用Ansible中与copy/file/template相关的函数.你可以通过Ansible的yum模块在需要的托管节点上安装libselinux-python.

    解决方法:ansible all -m shell -a "yum -y install libselinux-python"

    注意:是在远程管理的主机上安装,不是运行ansible的这个主机安装

    [user@localhost ~]$ ansible 192.168.0.107 -m shell -a "rm -rf /tmp/1.txt"

     [WARNING]: Consider using file module with state=absent rather than running rm

    192.168.0.107 | SUCCESS | rc=0 >>

  • 相关阅读:
    005 Eureka的HA机制和保护模式
    004 完善微服务信息
    003 注册微服务
    002 搭建单机的Eureka服务端
    001 项目的基础配置
    002 分支操作
    001 GIt的基本操作
    004 流程历史
    签名时出错: 未能对 binDebugapp.publishxxxx .exe 签名
    远程桌面无法复制粘贴传输文件解决办法
  • 原文地址:https://www.cnblogs.com/sanduzxcvbnm/p/7200609.html
Copyright © 2011-2022 走看看