Explaining of Ansible Windows Modules.

Explaining of Ansible Windows Modules.
Techiio-author
Written by Nilima PaulJanuary 31, 2022
10 min read
Ansible
1 VIEWS 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 1 VIEWS SHARE
Techiio-author
Nilima Paul

Technology Security Analyst

We will know in this article, what's the Ansible Windows Modules.

Definition of Ansible Windows Modules

Ansible windows modules are those Ansible modules that are utilized to do changes on Microsoft Windows machines. The sentence structure and conduct of these modules are equivalent to other Linux-based modules with various OS explicit errands and way separators. Ansible windows modules are utilized to arrange assignments on Microsoft Windows machines. These modules are created on PowerShell for the most part rather than Python. Additionally, the association strategy like WinRM or comparative Microsoft Windows upheld ones are utilized for this situation rather than SSH.

Syntax and Parameters

Ansible Windows Modules have a bunch of boundaries and adequate qualities. Additionally, a portion of the boundaries has default esteems. So it turns out to be more critical to learn and comprehend the different potential outcomes. These modules have comparative punctuation as some other modules. Just we want to deal with boundaries to pass in the playbook to accomplish our assignment prerequisites.

The following is a rundown of a portion of the significant Ansible Windows Modules with a short depiction. Kindly note this rundown is just for Microsoft Windows climate and not comprehensive as there are a lot more modules which Ansible people group is continuing to create:

  • win_chocolatey: This is used to manage packages.
  • win_chocolatey_facts: To create the collation of facts for use in chocolatey.
  • win_chocolatey_source: To do the management of chocolatey sources.
  • win_chocolatey_feature: To do the management of chocolatey features.
  • win_acl: To set the permission of files, directory, or registry for a system group or user.
  • win_command: To run a command on Windows PowerShell
  • win_copy: To copy files to windows hosts.
  • win_disk_facts: To display the attached disks and related information on windows targets.
  • win_dns_record: To perform DNS record management.
  • win_domain: To ensure the Windows domain's existence.
  • win_domain_controller: To manage a domain controller.
  • win_domain_computer: To manage the Active directory Computers.
  • win_domain_user: To manage Active Directory Users.
  • win_environment: To modify the environment variables.
  • win_eventlog: To Manage Windows Event.
  • win_feature: To uninstall and install any Windows Feature on Windows.
  • win_file: To manage files.
  • win_find: To find files.
  • win_firewall: To manage Windows.
  • win_format: To format.
  • win_get_url: To download files over HTTP/HTTPS/FTP.
  • win_hostname: To manage the computer name.
  • win_mapped_drive: To map the network drives.
  • win_package: To do package installation or uninstallation.
  • win_ping: To test the working setup with windows
  • win_reboot: To reboot a machine.
  • win_regedit: To do regist management.
  • win_service: To manage the services
  • win_updates: To do a windows update.
  • win_wait_for: To wait for a condition to fulfill before continuing in the playbook
  • win_user: To manage local windows users.
  • win_wait_for_process: To wait for a process to not exist or exist before continuing in the playbook.
  • win_webpicmd: Install packages on target machines using Web platform installer CLI.
  • win_whoami: To get the current user details.
  • win_iis_virtualdirectory: To configure a virtual directory on IIS.
  • win_iis_website: To configure a website on IIS.
  • win_lininfile: To put a line in the file.

Each module has a separate set of parameters and options. you can refer to the below link for the latest Ansible Windows modules, on this page you can click on a module link to get a detailed picture of that module.

Working of Ansible Windows Modules

In Ansible, playbooks are composed on YAML design, and each module is composed inside a playbook that should follow space and separate. Ansible Windows modules work in much the same way. In any case, there are a couple of focuses that one should keep in mind before beginning to utilize or attempting to begin the utilization of Ansible Windows modules.

  • PowerShell 3.0 and .NET 4.0 essentially should be introduced on track Windows
  • A WinRM audience ought to be made if not existing and
  • In the most recent arrival of Ansible, Win32-OpenSSH support was given, however, that is tested right now. It may work or not for your situation. So attempt it first in Lab
  • Other than WinRM, there are other association techniques like Basic,
  • As Windows isn't a POSIX working framework, there are numerous limits, in this way better you should attempt each arrangement in Labs
  • For custom new modules, you can make module code in PowerShell and afterward documentation in Python with a similar record name

Examples of Ansible Windows Modules

In this part, we will do a few commonsense models. We will make playbooks on the Ansible regulator hub named Ansible1. Additionally, we have tartargetedndows machines as windows and WinServer1.lablad1.local. Utilizing the playbooks, we attempt to make changes or bring information from a remote objective Windows machine.

Example #1

In this example, we will simply use Ansible win_ping module to check the connection and authentication success from the Ansible controller node to the target windows machine. We use the below command for the same.

ansible window -m win_ping

In the output, you can see that connection was successfully checked.

blogpost

Example #2

In this example, we have a remote host named WinServer1.lablad1.local. On which we will run the command using the Ansible windows module named win_command. Then register the output in a variable named netstat. To print the output contained in variable netstat, we will use the Ansible module debug. For this task, we have a playbook like below:

---
-name: test cmd from win_command module hosts: lablad1.local
tasks:
-name: run an executable command on remote Windows system win_command: netstat -e
register: netstat
-debug: var=netstat

Now run this playbook like below:

ansible-playbook ansible_win_command.yaml

The Output will look like below, where you can see above, in stdout_lines, all output by running netstat

commandon thee target machine:

blogpost

Conclusion

As we found in this article, Ansible Windows modules are exceptionally helpful and a piece precarious to use in the IT foundation climate. In any case, when we have decent information on these sorts of modules, we can undoubtedly do Microsoft Windows organization and functional changes. So first learn them and afterward use them.

Ansible
Python
ansible inventory
yaml
ansib facts
1 VIEWS 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 1 VIEWS SHARE
Was this blog helpful?
techiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plan
You must be Logged in to comment
Code Block
Techiio-author
Nilima Paul
Technology Security Analyst
Techiio-followerTechiio-followerTechiio-follower
201 Blog Posts
0 Discussion Threads
Trending Technologies
15
Software40
DevOps46
Frontend Development24
Backend Development20
Server Administration17
Linux Administration26
Data Center24
Sentry24
Terraform23
Ansible83
Docker70
Penetration Testing16
Kubernetes21
NGINX20
JenkinsX17
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance