如何使用 Ansible 创建目录 [英] How to create a directory using Ansible

查看:128
本文介绍了如何使用 Ansible 创建目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Ansible playbook 在基于 Debian 的系统上的 /srv 中创建目录 www?

How do you create a directory www at /srv on a Debian-based system using an Ansible playbook?

推荐答案

您需要文件模块.要创建目录,您需要指定选项 state=directory :

You want the file module. To create a directory, you need to specify the option state=directory :

- name: Creates directory
  file:
    path: /src/www
    state: directory

您可以在 https://docs 上查看其他选项.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html

这篇关于如何使用 Ansible 创建目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆