Reputation: 20232
I am trying the following task from a role in Ansible v2.2.1 running on Mac OS X v10.11.6 but I am getting a permissions issue (copied below):
- 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
error
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"}
Upvotes: 0
Views: 1493
Reputation: 68559
You cannot freely write to /usr/bin
on OS X / macOS (since El Capitan) - read about System Integrity Protection.
The common practice is to use /usr/local/bin
instead, but you need to add it to PATH
. Mind that Homebrew package manager assumes (by default) subdirectories of /usr/local
should be writable by a regular user, not root
.
Upvotes: 2