I am trying to set up a new Debian 10 build server, and the first step is 
gaining the ability to ssh into the device from outside my local network. 
For whatever reason, this is proving to be difficult and I haven't the 
slightest clue why. When I try to ssh into my server with user@hostname, I 
get the error: 

ssh: Could not resolve hostname {hostname}: Name or service not known

When I try to ssh into my server with user@IPADDRESS it's successful

ping {hostname} : ping: {hostname}: Name or service not known
ping {IP}: successful

nslookup {hostname}: 

;; Got SERVFAIL reply from x.x.x.x, trying next server
Server:         x.x.x.x.
Address:       x.x.x.x.#53

** server can't find {hostname}: SERVFAIL

nslookup {IP}: successful



Ansible Playbook:

- hosts: buildservers
   remote_user: root
   roles:
     - buildservers


I'm trying to run ansible role on multiple servers, but i get an error:

fatal: [hostname]: UNREACHABLE! => {"changed": false, "msg": "Failed to 
connect to the host via ssh: ssh: Could not resolve hostname hostname: Name 
or service not known", "unreachable": true}

ansible-playbook -vvvv

ansible-playbook 2.8.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = 
[u'/home/kjames/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Apr  9 2019, 14:30:50) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-36)]
Using /etc/ansible/ansible.cfg as config file

setting up inventory plugins
host_list declined parsing /home/kjames/ds9/buildservers-qa as it did not 
pass it's verify_file() method
script declined parsing /home/kjames/ds9/buildservers-qa as it did not pass 
it's verify_file() method
auto declined parsing /home/kjames/ds9/buildservers-qa as it did not pass 
it's verify_file() method
Not replacing invalid character(s) "set([u'-'])" in group name (RHEL7E-ARM)
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to 
allow bad characters in group names by default, this will change, but still 
be user
configurable on deprecation. This feature will be removed in version 2.10. 
Deprecation warnings can be disabled by setting deprecation_warnings=False 
in ansible.cfg.
 [WARNING]: Invalid characters were found in group names but not replaced, 
use -vvvv to see details

Not replacing invalid character(s) "set([u'-'])" in group name (RHEL7E-ARM)
Parsed /home/kjames/ds9/buildservers-qa inventory source with ini plugin
statically imported: 
/home/kjames/ds9/roles/buildservers/tasks/regular-packages.yaml
Loading callback plugin default of type stdout, v2.0 from 
/usr/lib/python2.7/site-packages/ansible/plugins/callback/default.pyc

PLAYBOOK: new-buildserver.yaml 
*******************************************************************************************************************************************
Positional arguments: new-buildserver.yaml
ask_pass: True
check: True
become_method: sudo
inventory: (u'/home/kjames/ds9/buildservers-qa',)
forks: 5
tags: (u'all',)
verbosity: 4
connection: smart
timeout: 10
1 plays in new-buildserver.yaml

PLAY [buildservers] 
******************************************************************************************************************************************************

TASK [Gathering Facts] 
***************************************************************************************************************************************************
task path: /home/kjames/ds9/new-buildserver.yaml:13
<hostname> ESTABLISH SSH CONNECTION FOR USER: root
<hostname> SSH: EXEC sshpass -d10 ssh -vvv -C -o ControlMaster=auto -o 
ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o 
ControlPath=/home/kjames/.ansible/cp/2a56e2da62 hostname '/bin/sh -c 
'"'"'echo ~root && sleep 0'"'"''
<hostname> (255, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 
2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: 
/etc/ssh/ssh_config line 58: Applying options for *\r\ndebug1: auto-mux: 
Trying existing master\r\ndebug1: Control socket 
"/home/kjames/.ansible/cp/2a56e2da62" does not exist\r\ndebug2: resolving 
"hostname" port 22\r\nssh: Could not resolve hostname hostname: Name or 
service not known\r\n')





-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/307ea381-cc17-46e6-9dae-9b07cc07d78b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to