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,544 views

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

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,850 points
1,328 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,400 points
418 views
0 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
958 views
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
119 views