Python invocation from Ansible

Hi Team,

One of the file contains list of servers(centralized server) and related to Dev environment .
Requirement is that connect each and every server remotely , execute stop command(s )of respective services and do manipulation of 2 or 3 conf files( add & remove lines) , start the services accordingly .

Is it something achievable in ansible/python/ansible & python ? if some one already worked on this scenario , please share the details

Thanks in Advance !!

Not sure what you mean by “one of the file” but connecting to a bunch of servers, changing a few files and restarting their services is the bread & butter of ansible and definitely doable without needing to use python at all.

Thanks for your anticipation !!

mean to say , bunch of servers name maintaining under hosts file.

Do you have any sample implementation/web link or info related to this topic ;

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html

These are generally very basic ansible concepts. A simple google search should find all the info you need.