I’m a beginner with Ansible.
I wanna know how to check if configuration of test server and prod are same or if there is a difference.
And if it’s possible, how to know what is the difference between them.
You have to provide more details than the abstract requirement.
What configuration do you want to check exactly? Is the configuration stored in some file, database, etc?
Looks like you might want to run a diff against two configuration files.
Having said that, you might want to consider this:
Use Ansible to generate configuration and deploy to the target servers. Manage the differences of environments(prod and test) in inventories. That way you don't have to compare the configuration manually.
To explain you the context. Currently we have an excel file when we put ALL configuration of both server (prod and test).
Here an example of parameters we compare for an apache server :
It looks like a mixture of desired state and actual state - but in a spreadsheet?
In any case the advice form the previous poster sounds like a good plan. Just have one source of truth and be done with it.
Regarding the use of a spreadsheet, that is possible but I wonder what benefit that gives. For sure it’s more difficult to keep that in version control.
This Speadsheet gets populated manually and these OK/KO values are a simply excel formule to compare both values.
You both comfirm that Ansible is the best way to maintain sure control of configurations and comparison of both environnement.
Do you know a good tutorial to set up this system ?
I'd start with the official documentation. Learn some basic Ansible concepts like inventory and start with template module. If you have any specific questions, ask here.