From the course: Ansible: From Basics to Guru by Pearson

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Lesson 4 lab solution: Using ad-hoc commands

Lesson 4 lab solution: Using ad-hoc commands - Ansible Tutorial

From the course: Ansible: From Basics to Guru by Pearson

Lesson 4 lab solution: Using ad-hoc commands

For this task, we are talking about which module. Well, in case you don't know, ansible-doc-l. And scroll through the list and see if there is anything that you think is convenient. And then you'll find ansible.builtin.file, manage files and file properties. I'd go for that. Ansible doc on file allows you to check what you can do. And what do we have? Well, we have file and in file we can do what? Well, we can set a path and we can set a state. And the state we can use state is absent. And oh boy, apparently file can't copy. So do we have anything better? back to Ansible doc minus L and have a look at the list. This is how you start an Ansible. Have a look at the Ansible doc minus L and see if there's a module that allows you to do whatever you want to do. And there we go. We find the copy module, copy files to remote locations. So Ansible doc on copy is giving more information about how it works so we can use the content. We've seen that before. There is the desk for the destination.…

Contents