[ansible-project] Re: Ansible best practice

2017-01-31 Thread Rui Goncalves
Hi Jinesh.

thank you!

On Tuesday, January 31, 2017 at 2:55:38 PM UTC, Jinesh Choksi wrote:
>
> Hi Rui,
>
> You can find a role for installing Prometheus here: 
> https://github.com/kozmagabor/ansible-prometheus
>
> Which also has a complementary role to setup the mongodb exporter: 
> https://github.com/William-Yeh/ansible-mongodb-exporter
>
> I found both of the above via Ansible Galaxy: 
> https://galaxy.ansible.com/kozmagabor/prometheus/
>
> 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
>
> On Tuesday, 31 January 2017 13:50:27 UTC, Rui Goncalves wrote:
>>
>> 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
>>
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d4295b84-8677-4902-a16c-e52c03fd52b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible best practice

2017-01-31 Thread Jinesh Choksi
Hi Rui,

You can find a role for installing Prometheus here: 
https://github.com/kozmagabor/ansible-prometheus

Which also has a complementary role to setup the mongodb exporter: 
https://github.com/William-Yeh/ansible-mongodb-exporter

I found both of the above via Ansible Galaxy: 
https://galaxy.ansible.com/kozmagabor/prometheus/

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

On Tuesday, 31 January 2017 13:50:27 UTC, Rui Goncalves wrote:
>
> 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
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/03b3d904-11ec-43f7-97a4-9fe3a777b838%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible Best Practice.

2015-12-07 Thread Mike Biancaniello
Originally, I was containing my vars within the roles, but after realizing 
that those vars override everything else, instead, I only populate the 
default/main.yml with vars inside the roles, just so things don't error, 
and define everything else in my main group_vars.

So, in my setup, when I have vars that are global, I put them in 
group_vars/all/*, then label them if there is more than one option.

e.g. 
#file: group_vars/all/nfs_servers
---
nfs_exports:
  git:
server: 1.1.1.1
export: /data/git
mount_point: /mnt/git
options: defaults,_netdev
  media:
server: 1.1.1.1
export: /data/media
mount_point: /var/lib/media
options: defaults,_netdev
  home_dirs:
server: 2.2.2.2
export: /data/home_dirs
mount_point: /home
options: defaults,_netdev



#file: group_vars/git_servers
---
nfs_mounts:
  - git



#file: group_vars/desktops
---
nfs_mounts:
  - home_dirs
  - media





On Wednesday, December 2, 2015 at 4:20:21 PM UTC-5, Jason Morgan wrote:
>
> I am currently developing a Playbook consisting of a number of roles via 
> include statements as show below:
>
> hosts: testing
>sudo: yes
>roles:
>- timezone
>- ntp
>- mariadb
>- nfs-server
>
> I would appreciate some advice of where to put all the varables for the 
> server eg Database , NFS exports, Timezone etc Would they be added as vars: 
> in the main playbook ? As vars under a host_vars directory ?
>
> Thanks Jason
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e12e4106-285c-4d76-98d1-ddd7a3596850%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.