You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi all,
I have no experience writing ansible roles. At the moment I'm trying to write a few ansible roles, but I'm not sure how to separate responsibilities.
I have two roles. - prometheus - installs and configures prometheus. - mongodb - Installs and configures mongodb database.
Prometheus needs to be configured in order to scrap metrics about mongoDB. Basically, it's necessary to put a file on a directory where the prometheus server is installed, containing information about mongodb location, etc... the question is: Should I configure this on the prometheus role? It seems to me that I'm polluting the prometheus role with things that belong elsewhere. This way, I'm also coupling the prometheus role with a specific use case. It's recommended to create a separate role to configure mongodb location on prometheus?
What's the best practice?
Thanks, Rui
Jinesh Choksi
unread,
Jan 31, 2017, 9:55:38 AM1/31/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
Ansible Galaxy has several roles available for installing Prometheus.
You could hence avoid creating your own roles and use the above or jump start your own roles based on the above.
To answer your question, it looks cleaner if you split into multiple roles instead of polluting the Prometheus role with something which is not a hard dependency.
Regards,
Jinesh
Rui Goncalves
unread,
Jan 31, 2017, 10:29:22 AM1/31/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi Jinesh.
thank you!
Dick Davies
unread,
Jan 31, 2017, 12:01:43 PM1/31/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible list
Just apply both roles to your mongodb group, and if you want to be explicit
you'd just set some vars on that group that both roles can use to find
paths etc.