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

0 votes

Hi Guys.

I am trying to configure the Apache webserver to remote systems using Ansible-Playbook. So I need to create a folder for the home directory. How can I create a folder in a remote system from Ansible code?

Aug 20, 2020 in Ansible by akhtar
• 38,260 points
4,329 views

2 answers to this question.

0 votes

Hi@akhtar,

You can use the file module in your Ansible-Playbook. This allows to create a directory in your remote system. You can use the below code in your playbook.

 - name: Document root creation
    file:
      state: directory
      dest: "{{ document_dir }}"
    tags: web
    register: y

answered Aug 20, 2020 by MD
• 95,460 points

You can use file module to create files and directory. You should read how to use file module in ansible

0 votes
answered Aug 23, 2020 by anonymous
• 160 points

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer

How to start httpd service in a remote system using Ansible?

Hi@akhtar, Ansible has a module named service. This ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,460 points
3,426 views
0 votes
1 answer

How to create a group of Managed Nodes in Ansible?

Hi@akhtar, You can use tags in your inventory ...READ MORE

answered Aug 1, 2020 in Ansible by MD
• 95,460 points
1,295 views
0 votes
1 answer

How to create a variable in Ansible Playbook?

Hi@akhtar, Variable in playbooks are very similar to using variables in ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,460 points
1,336 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
4,062 views
+2 votes
1 answer
0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,460 points
14,485 views
0 votes
1 answer

How to create a security group in AWS using Ansible-Playbook?

Hi@akhtar, You can use the ec2_group module in ...READ MORE

answered Aug 13, 2020 in Ansible by MD
• 95,460 points
3,850 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