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 in Ansible by yash
362 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 by Cerdin

Related Questions In Ansible

0 votes
1 answer
0 votes
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,810 points
335 views
0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
72 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer
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 in Ansible by Jason
50 views