Wednesday, August 7, 2019

Ansible windows module structure and its configuration in inventory file

Windows Modules structure: win_something
List of officially supported modules: http://docs.ansible.com/ansible/list_of_windows_modules.html

Modules can be executed from command line or playbooks

ansible web -i inventory.yml -m setup
modules:
setup -- for the machine and OS details.

insted of providing yml file everytime, add the inventory to the config ile where the ansible running - base directory.

ansible.cfg
--------
[defaults]
inventory = ~/pluralsight/inventory.yml

ansible web -m setup

to run windows commands directly, use raw module.
ansible web -m raw -a "dir"

to control windows service use module: win_service
ansible web -m win_service -a "name=servicename"
ansible web -m win_service -a "name=servicename state=stopped" [o/p is yellow as state changed]

to install new feature: win_feature
ansible web -m win_feature -a "name=Telnet-Client state=present"


No comments:

Post a Comment