tl;dr
= How do OS X users recommend working around this permissions error?
我在OS X 10.10.1上,我最近安装了Ansible,运行以下内容:
sudo pip install ansible --quiet
sudo pip install ansible --upgrade
我想从一个galaxy角色开始安装自制软件,并运行以下错误:
$ ansible-galaxy install geerlingguy.homebrew
- downloading role 'homebrew', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-homebrew/archive/1.0.1.tar.gz
- extracting geerlingguy.homebrew to /etc/ansible/roles/geerlingguy.homebrew
- error: you do not have permission to modify files in /etc/ansible/roles/geerlingguy.homebrew
- geerlingguy.homebrew was NOT installed successfully.
- you can use --ignore-errors to skip failed roles.
虽然我看到 /etc
由root拥有,但我没有看到文档中的任何注释说我应该 chmod
.
以供参考:
$ ansible --version
ansible 1.8.2
configured module search path = None
这是预期的还是我的安装错误?
3 回答
角色的默认位置是
/etc/ansible/roles
(版本<= 2.3 . 自v2.4起,默认位置已更改为~/.ansible/roles/
,an issue has been raised) . 使用ansible-galaxy
时需要指定--roles-path
. 这是ansible-galaxy install --help
所说的:你也可以在
ansible.cfg
中设置roles_path
; see the documentation for details .或者您可以使用
brew
来安装ansible
. 要做到这一点,你需要运行:如果您之前有任何安装,您可能会看到如下消息:
所以,运行
brew link --overwrite ansible
来解决这个问题 . 现在,您将能够在没有sudo
的情况下安装任何角色 .例:
正如我所看到你使用“sudo”来安装Ansible,我想可以继续使用“sudo”来安装ansible-galaxy . 这就是我刚才所做的 .