我正在使用在Mac OS X v10.11.6上运行的Ansible v2.2.1中的角色尝试以下任务,但我收到了权限问题(复制如下):
- name: Create the test scripts
copy:
src: "usr_bin_{{item}}"
dest: "/usr/bin/{{item}}"
owner: root
group: wheel
mode: 0755
with_items: ["abc", "def", "ghi"]
become: true
become_method: sudo
become_user: root
错误
failed: [localhost] (item=abc) => {"checksum": "44b300f4a9334ca0e34d0e5b3e2c121c76214f7c", "failed": true, "item": "abc", "msg": "Destination /usr/bin not writable"}
failed: [localhost] (item=def) => {"checksum": "dcd44e71b93f303c5d9abfcecd48c8637eabeeaa", "failed": true, "item": "def", "msg": "Destination /usr/bin not writable"}
failed: [localhost] (item=ghi) => {"checksum": "b9c28df8772702ba9b4b7d05e24c972aa536bdc3", "failed": true, "item": "ghi", "msg": "Destination /usr/bin not writable"}
答案 0 :(得分:1)
您无法在OS X / macOS上自由写入/usr/bin
(自El Capitan以来) - 请阅读System Integrity Protection。
通常的做法是使用/usr/local/bin
,但您需要将其添加到PATH
。请注意,Homebrew包管理器假定(默认情况下)/usr/local
的子目录应该是普通用户可写的,而不是root
。