Closed bisshwajitsamanta closed 3 years ago
Are you able to ssh to the target instance from the Concourse worker machine using the configured private key?
It appears that you're using the same ssh-key
for both the git
and ansible
resources. Are you sure that the private key of cloud_user
is the same as the one used to access git? That typically isn't true for my use cases.
I don't see anything wrong with your use of the ansible-playbook
resource.
I tried using seperate keys but i cannot still able to ssh.. though if i hijack the container i can ssh into the system.. i can see it is taking the new ansible-ssh-private-keys but it is still not working.
Output:-
TASK [Current Working Directory] ***** task path: /tmp/build/put/source-code/site.yml:7 Friday 22 November 2019 08:19:47 +0000 (0:00:00.113) 0:00:00.113 * <35.154.46.153> ESTABLISH SSH CONNECTION FOR USER: cloud_user <35.154.46.153> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o 'IdentityFile="/tmp/ansible-playbook-resource-ssh-private-key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="cloud_user"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0f7e6746af 35.154.46.153 '/bin/sh -c '"'"'echo ~cloud_user && sleep 0'"'"'' <35.154.46.153> (255, b'', b'') fatal: [test]: UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: ", "unreachable": true }
I have this same issue, though I cannot SSH into the target machine with the SSH key even when I hijack the container. I can use the same key on other systems to log into the machine just fine. DNS in the container works fine, and the target system is reachable.
@eric-gunn try to add a new line to ssh private key file. Like:
-----END OPENSSH PRIVATE KEY-----
# new line
@rk-p2p Apologies for the seriously delayed response, but all is well. Thanks!
Fixed in #20
Hi, am i missing something while using this resource is what i am curious about. Concourse Pipeline:-
resource_types:
resources:
name: ansible type: ansible-playbook source: debug: true user: cloud_user ssh_private_key: ((ssh-key)) verbose: vvv
name: source-code type: git source: uri: ((git-repo)) branch: master private_key: ((ssh-key))
jobs:
Ansible Playbook which i am intend to run across Multiple remote system:-
name: "Running Current Working Directory" hosts: test gather_facts: no
tasks:
name: "Current Working Directory" shell: pwd register: value
debug: msg: "The Current Working Directory {{value.stdout_lines}}"
Host.yml under inventory directory:-
all: hosts: test: ansible_connection: ssh ansible_host: "13.x.x.x" ansible_port: 22 ansible_user: cloud_user
After having all this i am getting unable to connect via ssh .. I dont know how to proceed from here. Can you help me here please?