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

1 answer to this question.

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
  - name: directory-name
      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,810 points
0 votes
1 answer
0 votes
1 answer

Ansible task to know if a path exists and if its a directory

Hi @Nisha, use the stat module provided ...READ MORE

answered Apr 2 in Ansible by Alok
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,810 points
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
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,240 points