Back

Explore Courses Blog Tutorials Interview Questions
+5 votes
3 views
in DevOps and Agile by (1.1k points)

I am new at using Ansible. I tried to create directories and download files using Ansible. Should I use shell commands for the same or any other special module is available?

1 Answer

+9 votes
by (10.5k points)
  • The following syntax can be used to create a directory called ABC in the path /src using file-module.


      - name:ABC (Creates directory)
         file:
           path: /src/www
           state: directory
or,
    - name: create project directory {{ common.proj_dir }}
    file: state=directory path={{ common.proj_dir }}


Now, to download a file using get_url-module, use the syntax given below:

- name: download files
  get_url: url={{ opencv.url }} dest={{ common.proj_dir }}/{{ opencv.file }}

 

Related questions

Browse Categories

...