How to download file from remote website using ansible.

Ansible is an open-source automation engine that automates software provisioning, configuration management, and application deployment. Playbooks are Ansible’s configuration, deployment, and orchestration language. Playbooks are expressed in YAML format (see YAML Syntax) and have a minimum of syntax, which intentionally tries to not be a programming language or script, but rather a model of a configuration or a process.

This article explains the steps for downloading the file from remote website usin ansible.

Open a yaml file in the Ansible installation folder and save the below content to it.

- name: Download foo.conf
  get_url:
     url: http://example.com/path/file.conf
     dest: /etc/foo.conf
     mode: 0440

Here we need to replace the domainname and filename accordingly.

Now we can execute this playbook to complete the task.

Leave a Reply

Your email address will not be published. Required fields are marked *