Hi,
On reading the docs my assumption has been that using `ansible_connection` 
= 'network_cli', tells ansible to run ssh to target and run commands. 

In my case it is not happening.

*$ cat /etc/issue*
Ubuntu 20.04.4 LTS \n \l

*$ ansible --version*
ansible* 2.9.6*
  config file = /etc/ansible/ansible.cfg
  configured module search path = 
['/home/dushyant/.ansible/plugins/modules', 
'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0]

$ *ansible-galaxy collection install dellemc.os10*   # Install dellemc roles

I setup my test dir as follows.

*$ tree .*
.
___ datacenter.yaml
___ host_vars
___ ___ R1.yaml
___ inventory.yaml

1 directory, 3 files


*$ cat datacenter.yaml *
---
- hosts: datacenter
  connection: network_cli
  collections:
    - dellemc.os10
  vars:
    build_dir: "/path/ansible/build/debug"

  roles:
    - os10_system

*$ cat inventory.yaml *
R1 ansible_host=192.168.111.117 

[site1]
R1

[datacenter:children]
site1

*$ cat host_vars/R1.yaml *
ansible_network_os: dellemc.os10.os10
ansible_connection: network_cli
ansible_ssh_user: test
ansible_ssh_pass: test123

os10_system:
  hostname: "VLT1-Primary"


When I run *ansible-playbook -vvv -i inventory.yaml datacenter.yaml*
ansible-playbook 2.9.6                                                     
                                                                            
                                                            
  ...                       
Parsed /path/ansible/test/inventory.yaml inventory source with ini plugin   
                                                                            
                                            
                                                                            
                                                                            
                                                           
PLAYBOOK: datacenter.yaml 
*****************************************************************************************************************************************************************************************
1 plays in datacenter.yaml                                                 
                                                                            
                                                            
                                                                            
                                                                            
                                                           
PLAY [datacenter] 
*************************************************************************************************************************************************************************************************
                                                                            
                                                                            
                                                           
TASK [Gathering Facts] 
********************************************************************************************************************************************************************************************

*task path: /path/ansible/test/datacenter.yaml:2                           
                                                                            
                                              <192.168.111.117> ESTABLISH 
LOCAL CONNECTION FOR USER: dushyant           *                            
                                                                            
                                 
<192.168.111.117> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
/home/dushyant/.ansible/tmp/ansible-local-893052ib2n_n69/ansible-tmp-1670934084.6666286-89363922941759
 
`" && echo ansible-tmp-1670934084.6666286-
89363922941759="` echo 
/home/dushyant/.ansible/tmp/ansible-local-893052ib2n_n69/ansible-tmp-1670934084.6666286-89363922941759
 
`" ) && sleep 0'                                                           
          
<R1> Attempting python interpreter discovery
....


*I do not see any SSH attempt in card. The `LOCAL` connection log line and 
username makes me wonder that it is not picking up my host_vars/ settings.*

*I have also tried changing variable 'ansible_ssh_user' variable to 
`ansible_user` as well. *

I must be missing something very simple. Any pointers would be helpful.    
         

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4ad0b2f3-4500-40b2-bcfe-3e9106453929n%40googlegroups.com.

Reply via email to