I want to fetch my RoR code from git, build it and then push it to multiple remote machine through Ansible script. I have mentioned my all machine details under hosts file of Ansible.
I have created the ssh key and pushed it under ssh key section of my github account. Here is my playbook.yml looks like.
---
- hosts: ansibleserver
tasks:
- git:
repo: git@github.com:abc/abc.git
dest: /tmp/LMS/
version: master
key_file: /root/.ssh/id_rsa
- hosts: redisservers
tasks:
- name: Copy file to a remote server
copy:
src: /root/LMS/
dest: /root/LMS/
- hosts: webservers
user: root
vars:
user: root
home_directory: "/root/LMS/app/"
rails_env: "development"
deploy_to: "{{ /root/LMS/ }}"
~
I am unable to execute a single task, below are the errors.
PLAY [ansibleserver] ***************************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
fatal: [192.168.193.30]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: \\S\nKernel \\r on an \\m\n !!!WARNING!!! \n############################################################################\nACCESS TO THIS SYSTEM IS STRICTLY RESTRICTED TO AUTHORIZED PERSONS ONLY \nUNAUTHORIZED ACCESS TO THIS SYSTEM IS NOT ALLOWED AND EVERY ACTIVITY IS MONITORED ON THIS \n SYSTEM. \t\t\n###########################################################################################\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic,password).", "unreachable": true}
PLAY RECAP *************************************************************************************************************************************************************
192.168.193.30 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
Since it fails at very first task, unable to move to 2nd and third one.