+5 votes
2 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.6k 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 }}

 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...