Ansiple script windows patching

Ansible patching activity document
1.    Server-ansible  – Ansible server.
prod1, prod2, sql, Manual
2.      [root@Server-ansible analytics]# cat /etc/ansible/hosts – validate the server list.
3.      Edit the if required to remove or add the servers,

[Manual]

Server1
server2
server3
server4

[sql]

Server5
server6
server7
server8

[prod1]
Server9
Server10
Server11
Server12
Server13
Server14
Server15

[prod2]

Server16
Server17
Server18
Server19
Server20
Server21
Server22
Server23
Server24
Server25


[test]

test server- fgtd-nte1-windows_testvm-app001.mhint – this server only for testing don’t use anyware.

4.      Checking the access for list of servers.
ansible Manual -m win_ping – This cmd to check the ping communication on the remote servers one by one.
Manual is the list of servers already defined
ansible prod1 -m win_ping
ansible prod2 -m win_ping
ansible sql -m win_ping

5.      Reboot and update the non sql servers
[root@Server1 analytics]# 
ansible-playbook prod1-reboot -vvvv | tee prod1_reboot_op.txt  -  For reboot,
ansible-playbook prod1 -vvvv | tee prod1_updateresult_op.txt  - update and result
ansible-playbook prod2-reboot -vvvv | tee prod2_reboot_op.txt- For reboot cmd
ansible-playbook prod1 -vvvv | tee prod2_updateresult_op.txt  - update and result

6.      Update the patch SQL servers.
ansible-playbook sql -vvvv | tee sql_op.txt  - For no reboot only update,

output:-

[root@Server1 analytics]# 

ansible-playbook prod1-reboot -vvvv | tee prod1_reboot_op.txt

ansible-playbook prod2-reboot -vvvv | tee prod2_reboot_op.txt

ansible-playbook sql -vvvv | tee sql_op.txt
 
11:50:46 AM
ok: [fgprd-bbdemoapp001] => {
"changed": false,
"found_update_count": 0,
"installed_update_count": 0,
"reboot_required": false,
"updates": {}
}
 
12:06:01 PM
[root@fServer1 analytics]# ansible fgprd-bbdemoapp001 -m win_updates -a 'category_names=CriticalUpdates'
fgprd-bbdemoapp001 | SUCCESS => {
"changed": false,
"found_update_count": 0,
"installed_update_count": 0,
"reboot_required": false,
"updates": {}
}
[root@Server1 analytics]# ansible fgprd-bbdemoapp001 -m win_updates -a 'category_names=SecurityUpdates'
fgprd-bbdemoapp001 | SUCCESS => {
"changed": false,
"found_update_count": 0,
"installed_update_count": 0,
"reboot_required": false,
"updates": {}
}
[root@
Server1 analytics]# 
12:12:10 PM
fatal: [Server2]: FAILED! => {
"changed": false,
"error": "Exception calling \"Search\" with \"1\" argument(s): \"The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. (Exception from HRESULT: 0x80070422)\"",
"failed": true,
"location": "at DoWindowsUpdate, <No file>: line 72\r\nat <ScriptBlock>, <No file>: line 222"
}
Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_updates.ps1
 
12:13:01 PM
ok: [Server4] => {
"changed": false,
"found_update_count": 0,
"installed_update_count": 0,
"reboot_required": false,
"updates": {}
}
 
12:19:14 PM
ok: [Server5] => {
"changed": false,
"found_update_count": 0,
"installed_update_count": 0,
"reboot_required": false,
"updates": {}
}
 
12:39:40 PM
fatal: [Server6]: FAILED! => {
"changed": false,
"error": "A reboot is required before more updates can be installed.",
"failed": true,
"location": "at DoWindowsUpdate, <No file>: line 125\r\nat <ScriptBlock>, <No file>: line 222"
}
 
12:54:58 PM


Comments

Popular posts from this blog

Using Non-Maskable Interrupt (NMI) facilities to troubleshoot unresponsive VMware Virtual Machine.

Removing invalid linked clone entries automatically using the ViewDBChk tool

VMTool update steps on Horizon VDI Parent VM