- We have two linux machines with a user called as devops with sudo permissions and NOPASSWD
- Ansible control node needs to have the information about the nodes which are attempting to connect. This information is referred to as inventory.
- Now we have executed the ansible basic command after creating the inventory Refer Here for the inventory and the command used. We got the following error
- To add the known-host entry lets manually login from ansible control node to node using ssh command
- Right now we are entering the password manually when connecting to the nodes which is not good for automation, So lets create a secure approach, which enables password less authentication with security
- Now on the ansible control node, i will be create a key pair
* Now lets copy the key from ansible control node to node 1 so that we can use key based authentication.
* Now lets try logging in into node1 without password
* Now lets exit and retry the command without password option Refer Here
* Now lets add localhost to the inventory Refer Here and run the ansible ping command
* It fails on localhost as the key is not copied, so copy the key using ssh-copy-id
- Overview of the Steps
From ansible I want to deploy an application into Linux Server
- Deployment Statements
- I want to deploy a spring boot application into ubuntu linux server and ensure the service is configured and running on port 8080.
- I want to deploy an node js application on the Linux Server and configure nginx to forward the requests to nodejs
- I want to deploy a postgresql database on the linux server
Steps to Resolve this
- Understand the Manual steps to acheive and try to execute them once before you start any automation with any tool in this case it is Ansible.
- Yaml Tutorial: Refer Here