【问题标题】:Ubuntu error with ansible provisioningansible配置的Ubuntu错误
【发布时间】:2014-11-10 18:41:42
【问题描述】:

这可能是一件非常简单的事情。我在 Ubuntu 12.04 上使用 ansible-playbook 运行配置:

ansible-playbook web.yml

并得到以下错误:

ERROR: The file ./hosts is marked as executable, but failed to execute correctly. 
If this is not supposed to be an executable script, correct this with `chmod -x ./hosts`.

所以我尝试更改该文件的权限,但看起来我不能这样做。首先,我通过运行 ls -l hosts 获取当前权限列表,它会打印我:

-rwxrwxrwx 1 vagrant vagrant 413 Nov 10 14:55 hosts

我试图用 chmod -x hosts 删除 -x,但之后它返回给我相同的权限列表,并且配置错误仍然存​​在。 p>

这是我的主机文件:

[web]
web.local ansible_ssh_host=10.42.1.90 ansible_ssh_port=22

[storage]
web-storage.local ansible_ssh_host=10.42.1.91 ansible_ssh_port=22
cr-stats.local ansible_ssh_host=10.42.1.92 ansible_ssh_port=22
cr-cache.local ansible_ssh_host=10.42.1.93 ansible_ssh_port=22

[local]
web.local
web-storage.local
cr-stats.local
cr-cache.local


#[remote]

和 web.yml:

---


- hosts: web
  sudo: True
  vars:
    deploy_app_name: web
  roles:
    - role: Stouts.redis
    - role: Stouts.python
    - role: Stouts.deploy
    - role: Stouts.nginx
    - role: Stouts.wsgi
    - role: Stouts.celery
    - role: Stouts.supervisor

- hosts: storage
  sudo: True
  vars:
    deploy_app_name: web
  roles:
    - role: Stouts.redis

有人可以帮忙吗?

【问题讨论】:

  • 能把hosts和web.yml的内容贴出来
  • 是的,我已将我的主机和 web.yml 文件添加到问题中。
  • 检查您是否属于 Vagrant 组或 Vagrant 用户,因为该文件归该用户所有。运行id 进行验证,如果您使用 sudo 运行,还可以以超级用户身份运行它。另外,你能告诉我们底层的文件系统吗?从那个目录运行df -T,或者只是mount我问,因为我看到像exfat和NTFS这样的分区显示为777。

标签: linux ubuntu vagrant ansible


【解决方案1】:

这将删除 x。

chmod 666 ./hosts

【讨论】:

  • 这并没有改变我的权限,它仍然显示:-rwxrwxrwx
  • 如果这没有改变权限,那么您的脚本位于只读驱动器上或非常奇怪的东西上。你没有 Ansible 问题。 @亚瑟
  • 如果您无法更改文件的 X 状态,您可能正在使用 SharedFolders 在 VirtualBox 中运行 Ubuntu - 这是我的问题。我的解决方案是创建一个“可执行库存”文件而不是静态文件。您可以在此处查看该问题的解决方案:stackoverflow.com/questions/26859360/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-10-26
  • 2017-09-19
  • 2012-12-12
  • 1970-01-01
  • 1970-01-01
  • 2015-02-04
  • 2018-08-20
相关资源
最近更新 更多