zoukankan      html  css  js  c++  java
  • ansible 2.7.1 常见错误总结

    1.RequestsDependencyWarning

    (refer to http://blog.51cto.com/mjunetwslinux/2177727?source=dra

    python库中urllib3 (1.21.1) or chardet (2.2.1) 的版本不兼容

    解决方法:

    pip uninstall urllib3

    pip uninstall  chardet

    pip install requests

    2.在 /etc/ansible/hosts 已经配置了IP地址、用户名和密码登陆失败

    临时解决方法:

    禁用公钥认证  

    export ANSIBLE_HOST_KEY_CHECKING=False

    手动登陆目标机器一次

    ssh username@hostname

    永久解决方法:

    vim /etc/ansible/ansible.cfg

    #host_key_checking= False取消注释

    3.how to change to root at playbook
    例1:target需要使用sudo su - 切换,则按照以下配置。

    #site.yml
    ---
    # This playbook deploys a simple playbook
    
    - hosts: gcp
      become_user: root
      become: yes
      become_method: su
      roles:
        - testplaybook1
    #run playbook like this
    ansible-playbook /appvol/ansible/ansible-examples/ansible_playbook_test/site.yml -u lihuanhuan80  --private-key /appvol/robin.private -e "ansible_become_exe='sudo su -'" -vvv

    或者这样配置site.yml

    ---
    # This playbook deploys a simple playbook
    
    - hosts: gcp
      become_user: root
      become: yes
      become_method: sudo
      roles:
        - testplaybook1
    #run playbook like this
    ansible-playbook /appvol/ansible/ansible-examples/ansible_playbook_test/site.yml -u lihuanhuan80  --private-key /appvol/robin.private -vvv


    例2:target需要使用dzdo su - 切换,则按照以下配置。

    #site.yml
    ---
    # This playbook deploys a simple playbook
    
    - hosts: gcp
      become_user: root
      become: yes
      become_method: su
      roles:
        - testplaybook1
    #run playbook like this
    ansible-playbook /appvol/ansible/ansible-examples/ansible_playbook_test/site.yml -u lihuanhuan80  --private-key /appvol/robin.private -e "ansible_become_exe='dzdo su -'" -vvv

    或者这样配置site.yml

    ---
    # This playbook deploys a simple playbook
    
    - hosts: gcp
      become_user: root
      become: yes
      become_method: dzdo
      roles:
        - testplaybook1
    #run playbook like this
    ansible-playbook /appvol/ansible/ansible-examples/ansible_playbook_test/site.yml -u lihuanhuan80  --private-key /appvol/robin.private -vvv
    如果您喜欢我,可以通过微信请我喝果汁。

    如果有疑问,可以留言或者发邮件给我 lhh_nj@163.com
  • 相关阅读:
    在MAC系统的eclipse里打开android sdk manager
    在MAC上搭建eclipse+android开发环境以及eclipse的svn插件的安装
    C语言入门
    变量和数据类型
    兼容 FF&IE 的替换鼠标选择文字方法(转载)
    JavaScript 中在光标处插入添加文本标签节点 详细方法
    jquery获取鼠标位置
    转:javascript Range对象跨浏览器常用操作
    日省三思
    jQuery强大的jQuery选择器 (详解)[转]
  • 原文地址:https://www.cnblogs.com/lihuanhuan/p/10612137.html
Copyright © 2011-2022 走看看