• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to update modified Group Policy on windows by using Ansible playbook

  • 01:13 lsb_release -a
  • 01:25 apt list -a ansible
  • 01:41 apt list -a python3
  • 01:50 pip list | grep pywinrm
  • 02:10 vi /etc/ansible/hosts
  • 03:15 vi policy.yml
  • 06:42 ansible-playbook policy.yml --syntax-check
  • 07:00 ansible-playbook policy.yml
6762

To update modified Group Policy on windows by using Ansible playbook

Introduction:

Ansible is an automatic configuration tool that works on a wide range of windows and UNIX-like systems. The win_shell module is used to run commands on windows systems. The win_unzip module is used to manage achieved files

Master Server Requirements:

ansible

python3-pip

pywinrm (python package)

Windows Requirements:

powershell 3+

Dot net 4

Installation Procedure:

Step 1 : Update the group policy in windows client system

snap1

Step 2: Check the OS version by using the following command


root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute
  

Step 3: Check the availability of Ansible package

root@linuxhelp:~# apt list -a ansible
Listing... Done
ansible/hirsute,hirsute,now 4.8.0-1ppa~hirsute all [installed]
ansible/hirsute,hirsute 2.10.7-1 all

Step 4: Check the availability of python3-pip package

root@linuxhelp:~# apt list -a python3
Listing... Done
python3/hirsute,now 3.9.4-1 amd64 [installed,automatic]

python3/hirsute 3.9.4-1 i386

Step 5: Check the availability of python package pywinrm

root@linuxhelp:~# pip list | grep pywinrm
pywinrm                0.4.2

Step 6: Create inventory for Windows node system

root@linuxhelp:~# vi /etc/ansible/hosts 


[windows]
192.168.6.104

[windows:vars]
ansible_user=Admin
ansible_password=Admin@123
ansible_port=5986
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

Step 7: Create playbook in the name of policy.yml

root@linuxhelp:~# vi policy.yml

- hosts: windows
  gather_facts: true
  tasks:
  - name: Extract the zip file
    win_unzip:
         src: E:\Policy\Modified.zip
         dest: C:\Windows\System32\GroupPolicy
  - name: Updating the Group Policy
    win_shell: gpupdate /force

Step 8: Check the syntax of the policy.yml ansible playbook by using the following command

root@linuxhelp:~# ansible-playbook policy.yml --syntax-check

playbook: policy.yml

Step 9: Run the policy.yml playbook by using the following command

root@linuxhelp:~# ansible-playbook policy.yml

PLAY [windows] ****************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************
ok: [192.168.6.104]

TASK [Extract the zip file] ***************************************************************************************
changed: [192.168.6.104]

TASK [Updating the Group Policy] **********************************************************************************
changed: [192.168.6.104]

PLAY RECAP ********************************************************************************************************
192.168.6.104              : ok=3    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Step 10: Group policy updated in windows client system by Ansible playbook snap2

By this To update modified Group Policy on windows by using Ansible playbook had comes to end

Tags:
isaac
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is the module for running commands on windows?

A

win_shell is the module for run command on windows

Q

What is the use of the win_unzip module?

A

It is used to Unzips compressed files and archives on the Windows node

Q

What is the protocol for windows to be ansible?

A

winrm is a protocol used by windows for ansible.

Q

What port number for ansible does windows allow?

A

5986 is port number windows allows for ansible.

Q

How to check the syntax of the ansible-playbook?

A

Use ansible-playbook --syntax-check commond to check the syntax

Related Tutorials in How to update modified Group Policy on windows by using Ansible playbook

Related Tutorials in How to update modified Group Policy on windows by using Ansible playbook

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018
How to install Windows 10 VM on Proxmox VE
How to install Windows 10 VM on Proxmox VE
Feb 24, 2018

Related Forums in How to update modified Group Policy on windows by using Ansible playbook

Related Forums in How to update modified Group Policy on windows by using Ansible playbook

Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
NFS
luke class=
clnt_create: RPC: Program not registered
Apr 25, 2017
Apache
isaac class=
How to disable apache welcome page on Ubuntu
Dec 15, 2018

Related News in How to update modified Group Policy on windows by using Ansible playbook

Related News in How to update modified Group Policy on windows by using Ansible playbook

How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Sep 2, 2017
Ubuntu Unity is no more: One Linux dream has been axed
Ubuntu Unity is no more: One Linux dream has been axed
Apr 7, 2017
Windows 10 lets Linux run inside Windows after Fall Creators Update
Windows 10 lets Linux run inside Windows after Fall Creators Update
Aug 3, 2017
What’s next for Ubuntu Linux Desktop?
What’s next for Ubuntu Linux Desktop?
Apr 11, 2017
Say Hi to Ubuntu's new mascot
Say Hi to Ubuntu's new mascot
Mar 22, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.