【问题标题】:Rewrite shell to Ansible task [closed]将 shell 重写为 Ansible 任务 [关闭]
【发布时间】:2017-07-12 21:33:22
【问题描述】:

如何将shell任务重写为文件模块任务

例如

  - name: Change permissions.
    shell: "chown -R {{ project_user }}:{{ project_user }} {{ project_root }}"

如何在file module 的帮助下重写上面的代码?

【问题讨论】:

标签: ansible


【解决方案1】:

这很简单:

- file:
    path: "{{ project_root }}"
    owner: "{{ project_user }}"
    group: "{{ project_user }}"
    recurse: true

查看示例:https://docs.ansible.com/ansible/file_module.html#id3

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-16
    • 2017-02-27
    • 1970-01-01
    相关资源
    最近更新 更多