Create a directory at a specific path using ansible

0 votes
I need to create a directory called testing at a specific location. How do I do this using Ansible?
Jan 9 in Ansible by Zunaid
36 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

To create a directory using Ansible, you need to set two parameters:

Path - absolute path, where you want to create the directory

state - by default, this is set to file, change it to directory since you need to create a directory.

Something like this:

- hosts: all
  tasks:
  - name: directory-name
    file:
      path: absolute-path
      state: directory
answered Jan 9 by Jason

Related Questions In Ansible

0 votes
1 answer

How can I create a new user using ansible ploybook?

You're switching from the root user. Root ...READ MORE

answered Mar 29, 2018 in Ansible by DareDev
• 6,520 points
68 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Using multiple config files using same template in a role in ansible

Go through this include_role module: tasks: - ...READ MORE

answered Jun 5, 2018 in Ansible by DareDev
• 6,520 points
176 views
+13 votes
2 answers
0 votes
1 answer
+1 vote
1 answer

Is it possible to append a large amount of text to a file using Ansible?

Here is concept which you can follow. blockinfile is ...READ MORE

answered Jul 30, 2018 in Ansible by Atul
• 10,190 points
1,386 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.