相关疑难解决方法(0)

使用become/become_user的Ansible 2.1.0无法设置临时文件的权限

我的服务器上有一个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
Run Code Online (Sandbox Code Playgroud)

在这种情况下使用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"}
Run Code Online (Sandbox Code Playgroud)

我在我的电脑上使用它的2.0.1.0,通常都是 - 文件夹/ var/www /有文件夹主要与所有者和组www-data

如果我只使用become_user:www-data,如果我使用become_method:sudo with become_user:www-data - 我得到了同样的错误

需要做些什么来解决这个问题?

git sudo vagrant ansible ansible-2.x

29
推荐指数
2
解决办法
1万
查看次数

标签 统计

ansible ×1

ansible-2.x ×1

git ×1

sudo ×1

vagrant ×1