Including and overriding Ansible galaxy roles in my roles

57 views
Skip to first unread message

Navid Paya

unread,
Oct 14, 2014, 10:10:04 AM10/14/14
to ansible...@googlegroups.com
Hi
So this is a refined version of a question I asked before. I have a role that aims to:
  - Do some specific change such as creating users
  - Install nodejs and ruby using rbenv
  - Run a rails app

I'm using two dependencies from Ansible galaxy for that:

How I do that at the moment is to install those roles using a requirements.txt file, and include them in my site.yml:

- hosts: all
  user: ubuntu
  sudo: true

  roles:
    - base-ami
    - nodesource.node
    - zzet.rbenv
    - rails

Now I have two questions.

1. Is there a way to include these roles from within one of my roles instead of the site.yml file so that I'll have just one role (base-ami) instead of four showing up in my site.yml. I tried to do something like this:

- name: Include the nodesource.node role
  include: zzet.rbenv

But then it would expect to see the role in my Ansible playbook. Is there a way to include a Ansible galaxy role from within my role?

2. I like what zzet.rbenv does but I want to change the version of Ruby it installs. According to the github page, that is controlled like this:

rbenv:
  env: user
  ruby_version: 2.1.2

How can I include this Ansible galaxy role in my base-ami role and then override these values?
Reply all
Reply to author
Forward
0 new messages