我的服务器上有一个 ansible 2.1.0,我通过以下方式进行部署vagrant以及在 PC 上。
“部署”角色有:
- name: upload code
become: true
become_user: www-data
git: [email protected] /cdn-cgi/l/email-protection:****.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
如果我只使用成为_用户:www-data并且如果我使用成为_方法:sudo与成为_用户:www-data - 我得到同样的错误
需要做什么来解决这个问题?
在 debian/ubuntu 上,您可以通过首先安装acl
远程主机上的包,就像这个 ansible 任务一样:
- name: install setfacl support
become: yes
apt: pkg=acl
与 redhat/centos 相同 - 安装acl
远程主机上的包:
- name: install setfacl support
become: yes
yum: name=acl
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)