Create directories and download files in Ansible using Ansible playbook

0 votes
I'm trying to use ansible playbook to create directories and download files, should use shell commands for it or are there any special modules available for it. I'm sorry if this is a dumb question, I'm a noob at ansible.
Jan 24, 2019 in Ansible by yash

1 answer to this question.

0 votes

Hey @Yash, 

you could either use file module to create directories. 

something like this:

- name: create project directory {{ common.project_dir }}
  file: state=directory path={{ common.project_dir }}

and get_url module to download files:

- name: download sources
  get_url: url={{ opencv.url }} dest={{ common.project_dir }}/{{ opencv.file }}

answered Jan 24, 2019 by Cerdin

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer
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,320 points
+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
+2 votes
1 answer
0 votes
1 answer

How do I wget a file from web server using shell in the ansible playbook

Hey Ayaan, you could probably use this ...READ MORE

answered Jan 24, 2019 in Ansible by Anushri
0 votes
1 answer

Create a directory at a specific path using ansible

To create a directory using Ansible, you ...READ MORE

answered Jan 9, 2019 in Ansible by Jason