ansible的问题

1 密码报错
如果密码是全数字,ansible的inventory是不支持的

2 用户报错
如果远程用户的没有/home/***目录,或者没有该目录的读写权限,会报错

3 未连接主机报错
有三种方法:

  • gedit /etc/ansible/ansible.cfg or ~/.ansible.cfg
    [defaults]
    host_key_checking = False
  • export ANSIBLE_HOST_KEY_CHECKING=False
    
  •  ansible-playbook -e 'host_key_checking=False' yourplaybook.yml
    

4 页面大透明的禁止

  • name: Disable transparent huge pages on all nodes defrag
    lineinfile: dest=/etc/rc.d/rc.local regexp='^.transparent_hugepage.$' line='echo never > /sys/kernel/mm/transparent_hugepage/defrag'

  • name: Disable transparent huge pages on all nodes enabled
    lineinfile: dest=/etc/rc.d/rc.local regexp='^.transparent_hugepage.$' line='echo never > /sys/kernel/mm/transparent_hugepage/enabled'

5 重启并等待返回

  • name: restart machine
    shell: sleep 2 && shutdown -r now "Ansible updates triggered"
    async: 1
    poll: 0
    sudo: true
    ignore_errors: true

  • name: waiting for server to come back
    local_action: wait_for host=all state=started delay=10 timeout=50
    sudo: false

6 安装openssl

  • name: copy openssl rpm
    copy: src=openssl-1.0.1e-42.el6_7.4.x86_64.rpm dest=/temp/httpd/openssl-1.0.1e-42.el6_7.4.x86_64.rpm
  • name: openssl rpm
    yum: name=/temp/httpd/openssl-1.0.1e-42.el6_7.4.x86_64.rpm state=present

你可能感兴趣的:(ansible的问题)