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, 2019 in Ansible by Zunaid
150 views

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
  tasks:
  - name: directory-name
    file:
      path: absolute-path
      state: directory
answered Jan 9, 2019 by Jason

Related Questions In Ansible

0 votes
1 answer

How to create a directory using Ansible?

Hi@akhtar, You can use the file module. To ...READ MORE

answered 5 days ago in Ansible by MD
• 43,500 points
25 views
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,850 points
238 views
0 votes
1 answer

How to create a new encrpted file using Ansible Vault?

If you are creating a new file ...READ MORE

answered Jan 29, 2019 in Ansible by Kyraa
159 views
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, 2019 in Ansible by Alok
5,824 views
+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,420 points
610 views
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
5,751 views