Need a help on manage various OS

hi all,

We are using AWX to perform ansible jobs. I need help because I wanted to apply a restart schedule for a set of linux and windows vms. for linux we have a local account with ssh key and for windows we have a service account of AD.

So how can I run my single job handling windows and linux hosts in single playbook?
(i can only add once machine credential in a AWX template).

Regards,
Thirumalai.

I would split your inventory into groups by platform since Windows login requires a different method. For the Windows group you can configure the login method for Windows as needed to use RDP.

You could have two plays in the playbook that target the different groups in the “hosts” tag.

  • name: reboot windows hosts
    hosts: windows_hosts
    tasks:
    … do the reboots via winrm

  • name: reboot linux hosts
    hosts: linux_hosts
    tasks:
    … do the reboots via SSH

Walter

I can create a group in inventory but how can I use credentials for that? You ask me to have two different playbooks.
if its single playbook how can i mention credentials for windows and linux separately

You can set the variables to define login details in the group definition.

https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#inheriting-variable-values-group-variables-for-groups-of-groups

Walter

https://docs.ansible.com/ansible/latest/os_guide/windows_winrm.html

Walter