cancel
Showing results for 
Search instead for 
Did you mean: 
1_awsd_2
Mission Specialist
Mission Specialist
  • 150 Views

Ansible Navigator Acting Strange

Hello everyone,

I created a test environment to prepare for the RHCE exam and for some days now I`m having a problem with Ansible Navigator. The problem began when I updated the packages on my RHEL 9.4 control node, after that when I tried to execute my scripts with ansible-navigator, scripts which should run on the control node where also ansible-navigator is installed, gave me the following error:


[student@control-station my_project]$ ansible-navigator run -mstdout ping-all.yml -vvvv
<cut>
debug1: Control socket \"/home/runner/.ansible/cp/5e0488efdc\" does not exist
debug2: resolving \"control-station\" port 22
debug2: ssh_connect_direct
debug1: Connecting to control-station [192.168.122.164] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 192.168.122.164 port 22: Connection refused
ssh: connect to host control-station port 22: Connection refused",
"unreachable": true
<cut>

I checked the /etc/hosts, ~/.ssh/config, inventory files but everything is fine with them.

[student@control-station ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.122.164 control-station


[student@control-station ~]$ cat .ssh/config
Host control-station
Hostname control-station
User student
Port 22
IdentityFile ~/.ssh/ansible_key


[student@control-station my_project]$ cat inventory
[workstation]
control-station


On one forum they suggested that if you define a custom control path in ansible.cfg it will fix the problem; I tried it:

cat ansible.cfg
[defaults]
inventory=./inventory
remote_user = student
gathering = explicit

[ssh_connection]
control_path_dir = /home/student/.ansible/cp/
control_path = %(directory)s

the error remains the same, only the path changes in 'debug1: Control socket \"/home/runner/.ansible/cp/5e0488efdc\" does not exist' to the path defined in the configuration file;
while this configuration was in place, I observerd a strange behaviour: I added a remote machine to the inventory file and changed the current directory into /home/student/.ansible/cp/ and ran the ansible script, in this case ansible-navigator created the connection socket for the remote machine, but for the local machine, control node, it didn`t do anything.

On another forum, it was suggested to set the control_path variable to none, then the "Control socket..." line dissapears from the output, but the rest remains the same.

I also looked at the /var/log/secure, /var/log/messages files; the /var/log/secure file does not contain anything usefull, the /var/log/messages file contains the same messages which are written on the screen by running ansible-navigator run -mstdout ping-all.yml -vvvv

Thinking that maybe when I updated the packages on the system, something did not update correctly, or some packages are too new for ansible-navigator, I created a new VM, with a bare RHEL 9.4 installation, installed the latest ansible-navigator and downloaded the ee-supported-rhel8:latest image from registry.redhat.io/ansible-automation-platform-25/ee-supported-rhel8:latest; the problem persisted...

Also tried older versions of anisble-navigator images from registry.redhat.io/ansible-automation-platform-22/23/24/ee-supported-rhel8:latest, on the bare system and also on my current control node, which has been updated, the problem still persists.

Tried to run same playbook with ansible-playbook and it runs as expected:

[student@control-station my_project]$ ansible-playbook ping-all.yml -v
<cut>
ok: [control-station] => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "ping": "pong"}
<cut>


Has anybody encountered this problem with ansible-navigator? If so, how did you solve it?


Thanks in advance

3 Replies
bonnevil
Starfighter Starfighter
Starfighter
  • 144 Views

debug1: Control socket \"/home/runner/.ansible/cp/5e0488efdc\" does not exist
debug2: resolving \"control-station\" port 22
debug2: ssh_connect_direct
debug1: Connecting to control-station [192.168.122.164] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 192.168.122.164 port 22: Connection refused

That's reading like 192.168.122.164 is either not running SSH, not listening on 22/tcp, or blocking access to 22/tcp with its firewall.  Have you checked that?

 

kaiser
Flight Engineer
Flight Engineer
  • 125 Views

I would put my money on removing the ~/.ssh/config file first. My navigator works absolutely fine without the config file.

======================

[student@control-station ~]$ cat .ssh/config
Host control-station
Hostname control-station
User student
Port 22
IdentityFile ~/.ssh/ansible_key  

 

These parameters above are unnecessary.

- remove the config file.
- create password-less authentication again.

 

If the problem persists, I would suggest to double check the points mentioned by "Bonnevil" above.

1_awsd_2
Mission Specialist
Mission Specialist
  • 62 Views

Thank you for your replies @bonnevil and @kaiser

control-station is a VM on my machine and to run the playbooks I SSH into the VM; because I can connect to my VM withouth any problem, I would rule out the OpenSSH server not listening on port 22 or the firewall blocking the connection.

I removed the ~/.ssh/config file, created a new set of ssh keys but the error still remains the same.

@kaiser when you said that you do not use at all the ~/.ssh/config file, by any chance do you specify the key in your ansible.cfg file, like this?


[student@control-station my_project]$ cat ansible.cfg
[defaults]
inventory=./inventory
remote_user = student
private_key_file = ~/.ssh/ansible_key <--?

Also I would like to add a little correction to the original post:

when I add control_path options to the ansibe.cfg file:

[ssh_connection]
control_path_dir = /home/student/.ansible/cp/
control_path = %(directory)s

the error returned by ansible-navigator becomes:

debug1: Stale control socket /home/student/.ansible/cp, unlinking

not as I said in the original post, sorry for the missinforation.

Join the discussion
You must log in to join this conversation.