Ansible django的许可被否认

时间:2017-01-22 22:43:04

标签: ansible

这是vars

pythonpath: /usr/lib/python2.7
path: /srv/trydjango/

这是deploy.yml

- name: django migrate
  django_manage: command=migrate app_path={{ install_root }}/{{ project_name }} pythonpath={{ pythonpath }}

获得 fatal: [138.197.93.219]: FAILED! => {"changed": false, "cmd": "./manage.py migrate --noinput --pythonpath=/usr/lib/python2.7", "failed": true, "msg": "[Errno 13] Permission denied", "rc": 13}

2 个答案:

答案 0 :(得分:2)

这是一个Ansible错误。

由于manage.py没有执行权限,这在Vagrant下发生。我曾尝试过开票https://github.com/ansible/ansible/issues/15443

PS。作为临时解决方案,您可以尝试使用执行标志mount vagrant共享文件夹,如

config.vm.synced_folder "....",
    owner: "vagrant",
    group: "vagrant",
    mount_options: ["dmode=775,fmode=764"]

答案 1 :(得分:1)

添加以生成文件可执行文件

- name: Make executable
  file:
    path: /srv/trydjango/manage.py
    mode: 0777