How to use files with Ansible

In this series, we will show how to use Ansible. In this story, let’s focus on using files with Ansible.

First, let’s create an inventory in the hosts file:

vm_ansible ansible_host=127.0.0.1 ansible_port=2222 ansible_user=vagrant ansible_ssh_private_key_file=<PATH>/.vagrant/machines/ubuntu/virtualbox/private_key

To create a file or directory and set its permissions, use the filemodule.

Creation of a file

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store