Chapter3: How to run an Ansible Playbook on Linux target (s); in 5 easy steps
Objective: To run a play (set of tasks) on a remote Linux target host. We will use a RedHat Enterprise Linux instance created on Amazon EC2, for this exercise. Prerequisites: 1. You have setup Ansible Control Machine. Refer Chapter-1 otherwise. 2. You have a Linux instance to use as target host. Refer to my blogpost to create one on Amazon EC2 and choose a RHEL AMI (Amazon Machine Image). Step-1: This step is run on the Control Machine . We have to first setup trust between Control Machine and Target. Otherwise you cannot reach the target and will see the following error. On the control machine , generate an SSH key using ssh-keygen. Use the ssh-keygen command. Give the file name id_rsa to save the key in. Your public key will be saved in file id_rsa.pub Check the content of the public key file id_rsa.pub . Step-2: This step is run on the target host . Login to your target Linux host using PuTTY. Open .ssh/authorized_keys file. Copy the p...