两个不同版本的ansible为同一个ansible剧本提供了两个不同的输出

时间:2018-03-10 18:27:09

标签: ansible yaml

  - hosts: Ebonding
    become: yes
    become_method: sudo
    tasks
      - name: Clearing cache of Server4
        file: path=/weblogic/bea/user_projects/domains/tmp state=absent
        become: yes
        become_user: wls10      

Ansible版本2.0.0.0成功运行上面的剧本::

    PLAY     ***************************************************************************

    TASK [setup] *******************************************************************
    ok: [ggnqinfa2]

    TASK [Clearing cache of Server4] *********************************************** 
    ok: [ggnqinfa2]

    PLAY RECAP *********************************************************************
    ggnqinfa2                  : ok=2    changed=0    unreachable=0    failed=0

但是最新版本的ansible 2.5.0rc2遇到了以下错误::

PLAY [Ebonding] *****************************************************************************************************************************************************

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

TASK [Clearing cache of Server4] ************************************************************************************************************************************
fatal: [ggnqinfa2]: FAILED! => {"msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user (rc: 2, err: chown: /var/tmp/ansible-tmp-1520704924.34-191458796685785/: Not owner\nchown: /var/tmp/ansible-tmp-1520704924.34-191458796685785/file.py: Not owner\n}). For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"}
 PLAY RECAP **********************************************************************************************************************************************************
 ggnqinfa2                  : ok=1    changed=0    unreachable=0    failed=1

如何通过最新版本的ansible成功运行此剧本?

1 个答案:

答案 0 :(得分:0)

您可能正在使用的用户(wls10)没有对远程临时目录/var/tmp的写访问权。

这可以使用ansible.cfg覆盖,并通过remote_tmp设置到您具有写访问权限的目录 - 或者"普通临时目录" (比如/ tmp)设置了粘滞位。

有关详细信息,请参阅 http://docs.ansible.com/ansible/latest/intro_configuration.html#remote-tmp

相关问题