-1

Currently, I'm refactoring all jobs backup from different type of DBs (mongo, mysql, postgres) to ansible roles. The structure is below.

enter image description here

The thing here is different server have different DB's username, password, DB name. I don't want to use redundant jobs so I want to run different roles for different task with different variables. How can I achieve above demand with ansible, please let me know if you have any idea. Thank you very much.

Zeitounator
  • 38,476
  • 7
  • 53
  • 66
hoa.le
  • 13
  • 4
  • 1
    What about using [a variable file per server/group](https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#splitting-out-vars) as needed? Make sure you set them using [the correct precedence](https://vl-tlv-scm-03.isr.bmc.com:8443/projects/SAAS/repos/pipeline-library/pull-requests). – Uberhumus Aug 24 '23 at 12:12
  • 1
    You should read [How to build your inventory](https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html) – Zeitounator Aug 24 '23 at 15:58
  • thanks @Uberhumus and Zeitounator for the references – hoa.le Aug 25 '23 at 08:16

0 Answers0