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
956 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 Aug 10, 2020 in Ansible by MD
• 95,440 points
3,636 views
0 votes
2 answers

How to create a directory in remote nodes using Ansible-Playbook?

You can read install and setup apache ...READ MORE

answered Aug 23, 2020 in Ansible by anonymous
• 160 points
3,564 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,890 points
650 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
730 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,460 views
+2 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
13,992 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP