Update:
Further I went ahead and created a hosts file in my "ansible-virtualenv" 
and passed the path in the global ansible.cfg file.
Ran the following command in virtualenv and now I have following issue

*ansible win -i hosts -m win_ping*
 [WARNING]:  * Failed to parse 
/root/ansible-virtualenvs/ansible-virtualenv/playbook/hosts with yaml 
plugin: Syntax
Error while loading YAML.   expected '<document start>', but found 
'<scalar>'  The error appears to have been in
'/root/ansible-virtualenvs/ansible-virtualenv/playbook/hosts': line 4, 
column 1, but may be elsewhere in the file
depending on the exact syntax problem.  The offending line appears to be:  
[win] abc012.abctst.lcl
ansible_host=10.12.12.12 ^ here

 [WARNING]:  * Failed to parse 
/root/ansible-virtualenvs/ansible-virtualenv/playbook/hosts with ini 
plugin: /root
/ansible-virtualenvs/ansible-virtualenv/playbook/hosts:11: Expected 
key=value, got: ansible_user:
ansible.dep...@abctst.lcl

 [WARNING]: Unable to parse 
/root/ansible-virtualenvs/ansible-virtualenv/playbook/hosts as an inventory 
source

 [WARNING]: No inventory was parsed, only implicit localhost is available

 [WARNING]: provided hosts list is empty, only localhost is available. Note 
that the implicit localhost does not
match 'all'

abc012.ARITST.LCL | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 
10.12.12.206 port 22: Connection refused\r\n",
    "unreachable": true

I have mentioned in my hosts file created in "ansible-virtualenv" follwoing 
vars:

 [win:vars]
ansible_user: ansible.dep...@abc.lcl
ansible_password: xxxxxxxxxxx
ansible_port=5985
ansible_connection=winrm
ansible_winrm_server_cert_validation: ignore

Why is it still trying to use port 22?

On Friday, May 25, 2018 at 11:01:36 AM UTC-7, ansible...@gmail.com wrote:
>
> Hi Jordan,
> Assist me further as I am not able to find content relating to my problem.
>
> I installed a virtualenv.
> Did:
>
>    - 
>    - 
>    - Package       Version
>    - ------------- ---------
>    - ansible       2.5.3  
>    (/root/ansible-virtualenvs/ansible-virtualenv/bin/ansible)
>    - asn1crypto    0.24.0
>    - bcrypt        3.1.4
>    - certifi       2018.4.16
>    - cffi          1.11.5
>    - chardet       3.0.4
>    - cryptography  2.2.2
>    - enum34        1.1.6
>    - idna          2.6
>    - ipaddress     1.0.22
>    - Jinja2        2.10
>    - MarkupSafe    1.0
>    - ntlm-auth     1.1.0
>    - paramiko      2.4.1
>    - pip           10.0.1
>    - pyasn1        0.4.3
>    - pycparser     2.18
>    - PyNaCl        1.2.1
>    - pywinrm       0.3.0
>    - PyYAML        3.12
>    - requests      2.18.4
>    - requests-ntlm 1.1.0
>    - setuptools    39.2.0
>    - six           1.11.0
>    - urllib3       1.22
>    - wheel         0.31.1
>    - xmltodict     0.11.0
>
> Now what I am not able to understand is:
> 1. How should I try win_ping here?
> 2. Will it take my hosts file from etc/ansible/hosts?
>
> I tried following command:
> ansible all -m win_ping
>  
> [WARNING]:  * Failed to parse /etc/ansible/hosts with yaml plugin: Syntax 
> Error while loading YAML.   expected
> '<document start>', but found '<scalar>'  The error appears to have been 
> in '/etc/ansible/hosts': line 5, column 1,
> but may be elsewhere in the file depending on the exact syntax problem.  
> The offending line appears to be:
> #RobotWindowsSer ansible_host=10.7.7.199 VATCS028.ARITST.LCL 
> ansible_host=10.12.12.28 ^ here
>
>  [WARNING]:  * Failed to parse /etc/ansible/hosts with ini plugin: 
> /etc/ansible/hosts:14: Expected key=value, got:
> ansible_winrm_server_cert_validation: ignore
>
>  [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
>
>  [WARNING]: No inventory was parsed, only implicit localhost is available
>
>  [WARNING]: provided hosts list is empty, only localhost is available. 
> Note that the implicit localhost does not
> match 'all'
>
> What is happening now?
>
>
> On Thursday, May 24, 2018 at 3:20:24 PM UTC-7, Jordan Borean wrote:
>>
>> There is a conflict between a system package and pip trying to install 
>> another package which in Pip 10 it doesn't handle properly. You can do 
>> either of the following
>>
>>    - Use a virtualenv and run Ansible from there 
>>    
>> https://stackoverflow.com/questions/49916736/how-to-properly-handle-conflicting-distutils-libraries-with-pip
>>    - Install the packages for just the user "pip install pywinrm --user"
>>    - Skip the install of requests and continue to use the distuil 
>>    packaged version "pip install pywinrm --ignore-installed"
>>
>> That's what I would recommend you try
>>
>> Thanks
>>
>> Jordan
>>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5083d8c8-38e0-4ef7-b042-ef9479fe270d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to