【问题标题】:Permissions issue when using copy module in Ansible on Mac在 Mac 上的 Ansible 中使用复制模块时的权限问题
【发布时间】:2017-04-17 21:47:42
【问题描述】:

我正在尝试从在 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"}

【问题讨论】:

    标签: macos ansible osx-elcapitan ansible-2.x


    【解决方案1】:

    您不能在 OS X / macOS(自 El Capitan 起)上随意写信给 /usr/bin - 请阅读 System Integrity Protection

    通常的做法是改用/usr/local/bin,但您需要将其添加到PATH。请注意 Homebrew 包管理器假定(默认情况下)/usr/local 的子目录应该由普通用户写入,而不是 root

    【讨论】:

      猜你喜欢
      • 2017-07-28
      • 1970-01-01
      • 2012-03-28
      • 2014-12-19
      • 2014-12-20
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多