Playbooks against Remote Hosts
Connect to remote Linux and Windows hosts using Ansible playbooks.
Let’s look at how you can codify the ad-hoc command to connect to the Linux instance or virtual machine.
Connect to remote Linux host
You will learn how to convert the following ad-hoc command to an Ansible playbook:
Create the playbook
Create the playbook in these steps:
- Create a
ping.ymlfile. - Add the
hostsline to use the host pattern ofall.
- Create a
varslist and define the connection variables. Replace<Password>with your password.
Defining the variables in the playbooks prevents you from defining them at run time. ...