Not sure if i get your question. You can specify the group specific
variables including connection method like below. You need to identify
their OS so that you could specify which host will use which connection
method.

[all:vars]
ansible_connection=ssh
ansible_ssh_user=user
ansible_ssh_pass=user_pass

[host_linux]
192.168.[1:254].[1:3]

[host_linux:vars]
ansible_connection=ssh

[host_windows]
10.10.10.10

[host_windows:vars]
ansible_connection=winrm

*Regards,*
*Ankit*


On Thu, Apr 9, 2020 at 5:33 PM PH <[email protected]> wrote:

> Please, help me to understand, how fill hosts file.
> Now i have linux hosts and it's work's fine.
> Exaple, how host file look's like:
> [all:vars]
> ansible_connection=ssh
> ansible_ssh_user=user
> ansible_ssh_pass=user_pass
> [host_linux]
> 192.168.[1:254].[1:3]
>
> When trying to add windows hosts (ip adresses may be same as linux,
> because hosts about 1000 and i don't know exatly where linux\windows
> installed) with windows vars - all hosts including linux and windows hosts
> began connecting using winrm.
> Host file looks like:
> [host_linux]
> ansible_connection=ssh
> ansible_ssh_user=user
> ansible_ssh_pass=user_pass
> [host_linux]
> 192.168.[1:254].[1:3]
> [host_windows:vars]
> ansible_user=user
> ansible_password=user_pass
> ansible_connection=winrm
> ansible_winrm_server_cert_validation=ignore
> ansible_winrm_transport=basic
> [host_windows]
> 192.168.[1:254].[1:3]
>
> How do I fill in the host file so that Linux hosts run using ssh, Windows
> hosts using winrm.
>
> --
> 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/6c39eaa7-6ddb-4bdd-af09-b201b777ac57%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/6c39eaa7-6ddb-4bdd-af09-b201b777ac57%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CACecUhuB6fZLBRhPACio2yHS9b-ygD%3DRjX4yQstxwO5LiKQx%2BQ%40mail.gmail.com.

Reply via email to