我的服务器上有一个 ansible 2.1.0,我也通过vagrant和 PC 进行部署。“部署”角色有:
- name: upload code
become: true
become_user: www-data
git: repo=git@bitbucket.org:****.git
dest=/var/www/main
key_file=/var/www/.ssh/id_rsa
accept_hostkey=true
update=yes
force=yes
register: fresh_code
notify: restart php-fpm
tags: fresh_code
在这种情况下,使用 ansible 2.1.0 我得到一个错误:
fatal: [default]: FAILED! => {"failed": true, "msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user. For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"}
我在我的电脑上使用的 ansible 2.0.1.0 都是正常的 - 文件夹 /var/www/ 有文件夹 main 和所有者和组 www-data
如果我只使用 become_user: www-data 并且如果我使用 become_method: sudo 和 become_user: www-data - 我得到了同样的错误
需要做什么来解决这个问题?