Hello Team,
we are going to introduce patching through Ansible.
Following step manually we perform.
- pre artifacts.
- Before patching plain reboot.
- Patching excluding kernel and reboot
- Kernel patching and reboot.
Above steps we tried to do through ansible and we achieve our goal partially.
For one host patching, error mail came successfully, if we tired to patch server more than one server error mail will came for last server.
we need error mail should came for each hosts while performing patching.
Your help is more appreciable.
Regards,
Sadanand
Hello Team,
we are going to introduce patching through Ansible.
Following step manually we perform.
1. pre artifacts.
2. Before patching plain reboot.
3. Patching excluding kernel and reboot
4. Kernel patching and reboot.
Above steps we tried to do through ansible and we achieve our goal partially.
For one host patching, error mail came successfully, if we tired to patch server more than one server error mail will came for last server.
we need error mail should came for each hosts while performing patching.
Your help is more appreciable.
Without more information, I can only make assumptions.
Assuming your email sending code is inside the task that does the update.
Assuming said task is called for each server you are upgrading.
I would expect it to work.
Hello Mauricio,
Thanks for showing interest.
Here i am posting each yml code.
it is not working for each host and also we observe playbook is stuck some time after executing some task.
code for patching
=====Main yml=============
runsetup.yml
Good lord, I thought our patching process was complicated
I don’t have a specific answer to solve your issue; but, I do have some suggestions.
It looks like your playbook is designed to run non-interactively - kicked off from something like tower or control-m. My first suggestion is to start simple, run the plays for a local ansible-playbook command if possible. That will allow you to troubleshoot issues immediately rather than waiting for emails.
It appears you’re separating kernel and non-kernel patching. FWIW, that’s not absolutely necessary. yum -y update
will update rpms that support it, and install (not update) new kernels. Our specific patching task looks like:
`
- name: Patch All Hosts
yum:
name: ‘*’
state: latest
update_cache: yes
no_log: True
`
and seems to work fine.
I see you have ‘sleep # && reboot’ or some such. Assuming a reasonably recent version of ansible, the reboot module is much more straight forward.
Long story short: When designing new processes, I generally try to keep things as simple as possible and add complexity when needed. If this is an established process and you inherited it, you may need to redesign in a test environment.
Sorry i couldn’t be more help.
Doug O’Leary
Hi Sadnand.
I am looking for similar automation.
Can you please share the playbook if possible.
Regards
Amit