Re: [ansible-project] Role dependencies not being installed automatically

2017-06-13 Thread Listing
Ok cool, thanks!

On Tuesday, June 13, 2017 at 7:39:57 PM UTC+2, Brian Coca wrote:
>
> It is a runtime import, it has nothing to do with installation. 
>
>
> -- 
> Brian Coca 
>

-- 
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/db6c2386-4f90-4c4e-85b7-774f66769e9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Role dependencies not being installed automatically

2017-06-13 Thread Brian Coca
It is a runtime import, it has nothing to do with installation.


--
Brian Coca

-- 
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/CACVha7feMc7hzWXLc78UtyczofbvY0aGHvjuuyxpAuiROKkY1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Role dependencies not being installed automatically

2017-06-13 Thread Listing


On Tuesday, June 13, 2017 at 7:35:55 PM UTC+2, Brian Coca wrote:
>
> They are not installed automatically. 
>
>
> -- 
> Brian Coca 
>

Ah, so they are just there for the users that use this role so they can 
install the roles manually and then it will be included? 

-- 
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/c503d753-2a55-4e19-ae69-cf7609b83165%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Role dependencies not being installed automatically

2017-06-13 Thread Brian Coca
They are not installed automatically.


--
Brian Coca

-- 
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/CACVha7ery73-zxMSQbPYS-MohzLfYyv6t-gwC4u12MOsypqrOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Role dependencies

2016-09-21 Thread Dick Davies
I've used role dependencies to address a similar requirement (collectd
in our case).

http://docs.ansible.com/ansible/playbooks_roles.html#role-dependencies

If you make the telegraf role a dependency of the redis role, you'll
have access to vars
set by the telegraf role as well as its handlers by the time the redis
role runs.

you just a need a file roles/redis/meta/main.yml that looks like this:

---
dependencies:
   - { role: telegraf }



On 20 September 2016 at 10:26, Ferdinand Svehla  wrote:
> I am using the roles + site.yml recommended setup.
> Most, but not all boxes run telegraf (a stats collector), which is defined
> as an inventory group as a (tagged) role in site.yml.
>
> In my Redis role, if the current host has the telegraf role I'd like to add
> a file a folder (so Telegraf will pick it up) and refresh the telegraf
> service.
> Here is where it gets tricky - I would basically call out to a different
> role - what is the way to do this in Ansible?
>
> --
> 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/4673802a-da95-4bc4-9c53-ac33c4bc1860%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAK5eLPTwUOuaz%3DvcyDaeuxNVwoMSQEpqt0ihQUTfFJrbT19hfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] role dependencies - path to parent role's templates folder

2016-05-30 Thread Johannes Kastl
On 30.05.16 14:03 ProfHase wrote:
> Thanks Johannes,
> the problem about it is: There is no way to pass the role path of the 
> ``webapp1-role`` to the ``nginx`` role ( I'd rather not hardcode it, so 
> that I could use nginx as dependence for multiple roles)

You can't? At least it does for me:

dependencies:
  - { role: foobar, my_variable: whatever }

That way you can include a fail task in your nginx role (to fail when
the variable is not set) and use the variable as path to the file.
Untested...

Johannes

-- 
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/574C3432.5050306%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] role dependencies - path to parent role's templates folder

2016-05-30 Thread ProfHase
Thanks Johannes,
the problem about it is: There is no way to pass the role path of the 
``webapp1-role`` to the ``nginx`` role ( I'd rather not hardcode it, so 
that I could use nginx as dependence for multiple roles)
The 
{{ role_path }}

always resolves to the nginx role


Am Mittwoch, 25. Mai 2016 17:23:03 UTC+2 schrieb Johannes Kastl:
>
> On 25.05.16 16:43 ProfHase wrote: 
>
> > Unfortunately the nginx role does not search in `templates` folder of 
> the 
> > `webapp1-role` 
>
> Maybe you can give a relative path to the template module. So from 
> your role nginx you need to set a path something like this: 
>
> template: src=../webapp1-role/templates/foobar 
>
> Johannes 
>
>

-- 
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/5defbd6a-caa0-44df-a47d-e29da7807597%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] role dependencies - path to parent role's templates folder

2016-05-25 Thread Johannes Kastl
On 25.05.16 16:43 ProfHase wrote:

> Unfortunately the nginx role does not search in `templates` folder of the 
> `webapp1-role`

Maybe you can give a relative path to the template module. So from
your role nginx you need to set a path something like this:

template: src=../webapp1-role/templates/foobar

Johannes

-- 
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/5745C349.9040601%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] role dependencies and variables

2015-01-14 Thread vadimv Vatlin
Thanks. It's working now. 

On Wednesday, January 14, 2015 at 12:25:14 AM UTC+2, Tom Bamford wrote:
>
> Add the following to roles/php-fpm/meta/main.yml and that role will be 
> invoked for each dependency
>
> allow_duplicates: yes
>
> ​
>
> On 13 January 2015 at 20:54, vadimv Vatlin  > wrote:
>
>> Hello
>>
>> I want to create meta role to setup web site configuration nginx + 
>> php-fpm 
>>
>>
>> playbook client.yml:
>>
>> - roles:
>>
>>   - { role: web-site, sites: 'domain.com, domain1.com’, fpm_pool: 
>> ‘domain’ }
>>
>>   - { role: web-site, sites: 'site.com, site1.com', fpm_pool: ‘site’, 
>> www_dir: 'web', memory_limit: '128MB' }
>>
>>
>> role/web-site/meta/main.yml:
>>
>> allow_duplicates: yes
>>
>> dependencies:
>>
>>   - { role: php-fpm, pool: "{{ fpm_pool }}" }
>>
>>
>> role/php-fpm/
>>
>>
>> I include web-site role twice but role php-fpm invoked only once . Why ? 
>> and how can i invoke php-fpm role twice ?  
>>
>>  -- 
>> 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-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/6a8b0d67-15d1-4064-a00a-142f2f3054c7%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> 

-- 
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/76607a72-6b0a-4d66-84e3-ec21db2e9444%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] role dependencies and variables

2015-01-13 Thread Tom Bamford
Add the following to roles/php-fpm/meta/main.yml and that role will be
invoked for each dependency

allow_duplicates: yes

​

On 13 January 2015 at 20:54, vadimv Vatlin  wrote:

> Hello
>
> I want to create meta role to setup web site configuration nginx + php-fpm
>
>
> playbook client.yml:
>
> - roles:
>
>   - { role: web-site, sites: 'domain.com, domain1.com’, fpm_pool:
> ‘domain’ }
>
>   - { role: web-site, sites: 'site.com, site1.com', fpm_pool: ‘site’,
> www_dir: 'web', memory_limit: '128MB' }
>
>
> role/web-site/meta/main.yml:
>
> allow_duplicates: yes
>
> dependencies:
>
>   - { role: php-fpm, pool: "{{ fpm_pool }}" }
>
>
> role/php-fpm/
>
>
> I include web-site role twice but role php-fpm invoked only once . Why ?
> and how can i invoke php-fpm role twice ?
>
>  --
> 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/6a8b0d67-15d1-4064-a00a-142f2f3054c7%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAAnNz0MUrfjNVQPwjGAjY%3DTzkqSPBtvroDrQRF%3DhnRjqqf%2B-dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Role dependencies and ansible-galaxy

2014-10-14 Thread seaspicy
As per that issue (https://github.com/ansible/ansible/issues/9173), I am 
still experiencing problems despite the committed changes. I've removed the 
sample repositories linked to in that issue since all that is really needed 
to replicate this issue is the requirements.yaml file.

Given the following 
gist: https://gist.github.com/cspicer/7c3c37eaf8eff386f9ce

ansible-galaxy install will still fail using:

$ ansible-galaxy install -r requirements.yml
>
> Traceback (most recent call last):
>
>   File "/Users/spicy/Development/oss/ansible/bin/ansible-galaxy", line 
>> 901, in 
>
> main()
>
>   File "/Users/spicy/Development/oss/ansible/bin/ansible-galaxy", line 
>> 895, in main
>
> fn(args, options, parser)
>
>   File "/Users/spicy/Development/oss/ansible/bin/ansible-galaxy", line 
>> 711, in execute_install
>
> roles_left = map(ansible.utils.role_yaml_parse, yaml.safe_load(f))
>
>   File 
>> "/Users/spicy/Development/oss/ansible/lib/ansible/utils/__init__.py", line 
>> 432, in role_yaml_parse
>
> if 'github.com' in role["src"] and 'http' in role["src"] and '+' not 
>> in role["src"] and not role["src"].endswith('.tar.gz'):
>
> TypeError: string indices must be integers, not str
>
>
Not sure if this is my syntax that is an issue, or if this is still a bug. 
Should I file a new bug?

Thanks!

On Tuesday, September 30, 2014 12:05:09 PM UTC-7, Michael DeHaan wrote:
>
> Yeah so we have this is in the bug tracker now for Ansible I think, so 
> should be being tracked.
>
> https://github.com/ansible/ansible/issues/9173
>
> If not, please make sure there's a new bug.
>
>
>
> On Fri, Sep 26, 2014 at 4:00 PM, James Cammarata  > wrote:
>
>> You can always use the --ignore-errors option too, so that the 
>> installation continues if you're not concerned about those failures.
>>
>> On Fri, Sep 26, 2014 at 2:56 PM, > wrote:
>>
>>> Great, thanks for the clarification!
>>>
>>> It looks like I am running into a bug then. If my requirements.yml 
>>> includes a role and that dependency itself has further non-galaxy 
>>> dependencies (say from GitHub for example), ansible-galaxy install will 
>>> fail to install the first level dependency and error out. I'm not expecting 
>>> it to resolve transitive dependencies (though that would be nice). I'll see 
>>> if I can create an example demo of this and then submit an issue.
>>>
>>> Thanks again!
>>>  
>>>
>>> On Friday, September 26, 2014 12:46:48 PM UTC-7, James Cammarata wrote:

 Role dependencies that are not on Galaxy can be listed in the metadata 
 along with roles that are - however as Michael said, such roles should not 
 be shared via Galaxy since other users won't have access to them, and the 
 role will therefore not work.

 If you're writing a role for personal use however, you can list any 
 role dependencies there that you wish. The commented generated by the CLI 
 tool when using "init" to create a new role directly simply assumes that 
 the role will be uploaded to Galaxy, so really the comment should read "# 
 If you're going to upload this role to Galaxy, be sure to list only 
 dependencies that are also available via Galaxy".

 Hope that clears things up.


 On Fri, Sep 26, 2014 at 11:46 AM,  wrote:

> Hi Michael,
>
> Thanks for your response. 
>
> Absolutely, I understand that Galaxy is not a private content store – 
> this is exactly what I'm trying to avoid. I think there might be 
> confusion 
> when I say galaxy the tool vs galaxy the service.
>
> I'm using ansible-galaxy as a role depsolver to download roles from 
> private GitHub repositories, and occasionally from Galaxy (the service). 
> Because Ansible itself seems to understand meta/main.yml in that it'll 
> include any dependencies listed there in a run, it seemed like it could 
> be 
> used for non-galaxy roles (ie private roles). Since this happens 
> automatically within Ansible, it is very useful to include both public 
> and 
> private roles in the meta directory.
>
> If it isn't intended to use the meta directory to list both open 
> source and internal deps, is there a functionally equivalent alternative?
>
> Thanks.
>
>
>
> On Friday, September 26, 2014 5:15:59 AM UTC-7, Michael DeHaan wrote:
>>
>> "Is that a hard rule, that you can't add dependencies via the 
>> meta/main.yml workflow? "
>>
>> Right, That's the only way you add dependencies.
>>
>> What that was saying is roles on galaxy should have all their 
>> dependencies on galaxy, else the role should *not* be on galaxy.
>>
>> Why?  Because it's totally wrong to be sharing content with people 
>> they can't use :)
>>
>> Galaxy is not a place for personal private content, it's a place to 
>> share content with other OSS users.
>>
>>
>>
>>
>> On Fri, Sep 26, 2014 at 4:06

Re: [ansible-project] Role dependencies and ansible-galaxy

2014-09-30 Thread Michael DeHaan
Yeah so we have this is in the bug tracker now for Ansible I think, so
should be being tracked.

https://github.com/ansible/ansible/issues/9173

If not, please make sure there's a new bug.



On Fri, Sep 26, 2014 at 4:00 PM, James Cammarata 
wrote:

> You can always use the --ignore-errors option too, so that the
> installation continues if you're not concerned about those failures.
>
> On Fri, Sep 26, 2014 at 2:56 PM,  wrote:
>
>> Great, thanks for the clarification!
>>
>> It looks like I am running into a bug then. If my requirements.yml
>> includes a role and that dependency itself has further non-galaxy
>> dependencies (say from GitHub for example), ansible-galaxy install will
>> fail to install the first level dependency and error out. I'm not expecting
>> it to resolve transitive dependencies (though that would be nice). I'll see
>> if I can create an example demo of this and then submit an issue.
>>
>> Thanks again!
>>
>>
>> On Friday, September 26, 2014 12:46:48 PM UTC-7, James Cammarata wrote:
>>>
>>> Role dependencies that are not on Galaxy can be listed in the metadata
>>> along with roles that are - however as Michael said, such roles should not
>>> be shared via Galaxy since other users won't have access to them, and the
>>> role will therefore not work.
>>>
>>> If you're writing a role for personal use however, you can list any role
>>> dependencies there that you wish. The commented generated by the CLI tool
>>> when using "init" to create a new role directly simply assumes that the
>>> role will be uploaded to Galaxy, so really the comment should read "# If
>>> you're going to upload this role to Galaxy, be sure to list only
>>> dependencies that are also available via Galaxy".
>>>
>>> Hope that clears things up.
>>>
>>>
>>> On Fri, Sep 26, 2014 at 11:46 AM,  wrote:
>>>
 Hi Michael,

 Thanks for your response.

 Absolutely, I understand that Galaxy is not a private content store –
 this is exactly what I'm trying to avoid. I think there might be confusion
 when I say galaxy the tool vs galaxy the service.

 I'm using ansible-galaxy as a role depsolver to download roles from
 private GitHub repositories, and occasionally from Galaxy (the service).
 Because Ansible itself seems to understand meta/main.yml in that it'll
 include any dependencies listed there in a run, it seemed like it could be
 used for non-galaxy roles (ie private roles). Since this happens
 automatically within Ansible, it is very useful to include both public and
 private roles in the meta directory.

 If it isn't intended to use the meta directory to list both open source
 and internal deps, is there a functionally equivalent alternative?

 Thanks.



 On Friday, September 26, 2014 5:15:59 AM UTC-7, Michael DeHaan wrote:
>
> "Is that a hard rule, that you can't add dependencies via the
> meta/main.yml workflow? "
>
> Right, That's the only way you add dependencies.
>
> What that was saying is roles on galaxy should have all their
> dependencies on galaxy, else the role should *not* be on galaxy.
>
> Why?  Because it's totally wrong to be sharing content with people
> they can't use :)
>
> Galaxy is not a place for personal private content, it's a place to
> share content with other OSS users.
>
>
>
>
> On Fri, Sep 26, 2014 at 4:06 AM,  wrote:
>
>> Hi there,
>>
>> I'm currently using the in-development 1.8 version of Ansible to get
>> access to the enhanced requirements.yml features for the ansible-galaxy
>> command line tool. I'm using it to install roles from GitHub with the
>> appropriate config, and for the most part everything is working OK.
>> However, a few times I've ran into issues working with roles I've created
>> that have meta/main.yml dependencies specified.
>>
>> Until about an hour ago, when setting up a test case to replicate the
>> problem I am running into, I wasn't aware of the comment that is 
>> generated
>> in meta/main.yml when you do ansible-galaxy init – "  # List your role
>> dependencies here, one per line. Only dependencies available via galaxy
>> should be listed here. Be sure to remove the '[]' above if you add
>> dependencies to this list."
>>
>> Is that a hard rule, that you can't add dependencies via the
>> meta/main.yml workflow? I've actually been structuring some of my roles
>> around the functionality of adding a dependency in another role and
>> specifying variables, unaware that meta/main.yml dependencies are only 
>> for
>> galaxy resolution. I'd just like some clarification on this, and maybe
>> thoughts around an alternative workflow if I shouldn't be using role
>> dependencies this way.
>>
>> The problem I encountered before discovering this was that
>> ansible-galaxy would fail to install roles f

Re: [ansible-project] Role dependencies and ansible-galaxy

2014-09-26 Thread James Cammarata
You can always use the --ignore-errors option too, so that the installation
continues if you're not concerned about those failures.

On Fri, Sep 26, 2014 at 2:56 PM,  wrote:

> Great, thanks for the clarification!
>
> It looks like I am running into a bug then. If my requirements.yml
> includes a role and that dependency itself has further non-galaxy
> dependencies (say from GitHub for example), ansible-galaxy install will
> fail to install the first level dependency and error out. I'm not expecting
> it to resolve transitive dependencies (though that would be nice). I'll see
> if I can create an example demo of this and then submit an issue.
>
> Thanks again!
>
>
> On Friday, September 26, 2014 12:46:48 PM UTC-7, James Cammarata wrote:
>>
>> Role dependencies that are not on Galaxy can be listed in the metadata
>> along with roles that are - however as Michael said, such roles should not
>> be shared via Galaxy since other users won't have access to them, and the
>> role will therefore not work.
>>
>> If you're writing a role for personal use however, you can list any role
>> dependencies there that you wish. The commented generated by the CLI tool
>> when using "init" to create a new role directly simply assumes that the
>> role will be uploaded to Galaxy, so really the comment should read "# If
>> you're going to upload this role to Galaxy, be sure to list only
>> dependencies that are also available via Galaxy".
>>
>> Hope that clears things up.
>>
>>
>> On Fri, Sep 26, 2014 at 11:46 AM,  wrote:
>>
>>> Hi Michael,
>>>
>>> Thanks for your response.
>>>
>>> Absolutely, I understand that Galaxy is not a private content store –
>>> this is exactly what I'm trying to avoid. I think there might be confusion
>>> when I say galaxy the tool vs galaxy the service.
>>>
>>> I'm using ansible-galaxy as a role depsolver to download roles from
>>> private GitHub repositories, and occasionally from Galaxy (the service).
>>> Because Ansible itself seems to understand meta/main.yml in that it'll
>>> include any dependencies listed there in a run, it seemed like it could be
>>> used for non-galaxy roles (ie private roles). Since this happens
>>> automatically within Ansible, it is very useful to include both public and
>>> private roles in the meta directory.
>>>
>>> If it isn't intended to use the meta directory to list both open source
>>> and internal deps, is there a functionally equivalent alternative?
>>>
>>> Thanks.
>>>
>>>
>>>
>>> On Friday, September 26, 2014 5:15:59 AM UTC-7, Michael DeHaan wrote:

 "Is that a hard rule, that you can't add dependencies via the
 meta/main.yml workflow? "

 Right, That's the only way you add dependencies.

 What that was saying is roles on galaxy should have all their
 dependencies on galaxy, else the role should *not* be on galaxy.

 Why?  Because it's totally wrong to be sharing content with people they
 can't use :)

 Galaxy is not a place for personal private content, it's a place to
 share content with other OSS users.




 On Fri, Sep 26, 2014 at 4:06 AM,  wrote:

> Hi there,
>
> I'm currently using the in-development 1.8 version of Ansible to get
> access to the enhanced requirements.yml features for the ansible-galaxy
> command line tool. I'm using it to install roles from GitHub with the
> appropriate config, and for the most part everything is working OK.
> However, a few times I've ran into issues working with roles I've created
> that have meta/main.yml dependencies specified.
>
> Until about an hour ago, when setting up a test case to replicate the
> problem I am running into, I wasn't aware of the comment that is generated
> in meta/main.yml when you do ansible-galaxy init – "  # List your role
> dependencies here, one per line. Only dependencies available via galaxy
> should be listed here. Be sure to remove the '[]' above if you add
> dependencies to this list."
>
> Is that a hard rule, that you can't add dependencies via the
> meta/main.yml workflow? I've actually been structuring some of my roles
> around the functionality of adding a dependency in another role and
> specifying variables, unaware that meta/main.yml dependencies are only for
> galaxy resolution. I'd just like some clarification on this, and maybe
> thoughts around an alternative workflow if I shouldn't be using role
> dependencies this way.
>
> The problem I encountered before discovering this was that
> ansible-galaxy would fail to install roles from the requirements.yml if
> they had a meta/main.yml dependency specified that wasn't from galaxy – I
> guess I had been relying on what was on the local filesystem and what the
> tool downloaded.
>
> An example of how some of my dependencies are being used (this is from
> a role to install nodejs, calling another role I've created to manage apt
>

Re: [ansible-project] Role dependencies and ansible-galaxy

2014-09-26 Thread seaspicy
Great, thanks for the clarification!

It looks like I am running into a bug then. If my requirements.yml includes 
a role and that dependency itself has further non-galaxy dependencies (say 
from GitHub for example), ansible-galaxy install will fail to install the 
first level dependency and error out. I'm not expecting it to resolve 
transitive dependencies (though that would be nice). I'll see if I can 
create an example demo of this and then submit an issue.

Thanks again!
 

On Friday, September 26, 2014 12:46:48 PM UTC-7, James Cammarata wrote:
>
> Role dependencies that are not on Galaxy can be listed in the metadata 
> along with roles that are - however as Michael said, such roles should not 
> be shared via Galaxy since other users won't have access to them, and the 
> role will therefore not work.
>
> If you're writing a role for personal use however, you can list any role 
> dependencies there that you wish. The commented generated by the CLI tool 
> when using "init" to create a new role directly simply assumes that the 
> role will be uploaded to Galaxy, so really the comment should read "# If 
> you're going to upload this role to Galaxy, be sure to list only 
> dependencies that are also available via Galaxy".
>
> Hope that clears things up.
>
>
> On Fri, Sep 26, 2014 at 11:46 AM, > wrote:
>
>> Hi Michael,
>>
>> Thanks for your response. 
>>
>> Absolutely, I understand that Galaxy is not a private content store – 
>> this is exactly what I'm trying to avoid. I think there might be confusion 
>> when I say galaxy the tool vs galaxy the service.
>>
>> I'm using ansible-galaxy as a role depsolver to download roles from 
>> private GitHub repositories, and occasionally from Galaxy (the service). 
>> Because Ansible itself seems to understand meta/main.yml in that it'll 
>> include any dependencies listed there in a run, it seemed like it could be 
>> used for non-galaxy roles (ie private roles). Since this happens 
>> automatically within Ansible, it is very useful to include both public and 
>> private roles in the meta directory.
>>
>> If it isn't intended to use the meta directory to list both open source 
>> and internal deps, is there a functionally equivalent alternative?
>>
>> Thanks.
>>
>>
>>
>> On Friday, September 26, 2014 5:15:59 AM UTC-7, Michael DeHaan wrote:
>>>
>>> "Is that a hard rule, that you can't add dependencies via the 
>>> meta/main.yml workflow? "
>>>
>>> Right, That's the only way you add dependencies.
>>>
>>> What that was saying is roles on galaxy should have all their 
>>> dependencies on galaxy, else the role should *not* be on galaxy.
>>>
>>> Why?  Because it's totally wrong to be sharing content with people they 
>>> can't use :)
>>>
>>> Galaxy is not a place for personal private content, it's a place to 
>>> share content with other OSS users.
>>>
>>>
>>>
>>>
>>> On Fri, Sep 26, 2014 at 4:06 AM,  wrote:
>>>
 Hi there,

 I'm currently using the in-development 1.8 version of Ansible to get 
 access to the enhanced requirements.yml features for the ansible-galaxy 
 command line tool. I'm using it to install roles from GitHub with the 
 appropriate config, and for the most part everything is working OK. 
 However, a few times I've ran into issues working with roles I've created 
 that have meta/main.yml dependencies specified. 

 Until about an hour ago, when setting up a test case to replicate the 
 problem I am running into, I wasn't aware of the comment that is generated 
 in meta/main.yml when you do ansible-galaxy init – "  # List your role 
 dependencies here, one per line. Only dependencies available via galaxy 
 should be listed here. Be sure to remove the '[]' above if you add 
 dependencies to this list."

 Is that a hard rule, that you can't add dependencies via the 
 meta/main.yml workflow? I've actually been structuring some of my roles 
 around the functionality of adding a dependency in another role and 
 specifying variables, unaware that meta/main.yml dependencies are only for 
 galaxy resolution. I'd just like some clarification on this, and maybe 
 thoughts around an alternative workflow if I shouldn't be using role 
 dependencies this way.

 The problem I encountered before discovering this was that 
 ansible-galaxy would fail to install roles from the requirements.yml if 
 they had a meta/main.yml dependency specified that wasn't from galaxy – I 
 guess I had been relying on what was on the local filesystem and what the 
 tool downloaded. 

 An example of how some of my dependencies are being used (this is from 
 a role to install nodejs, calling another role I've created to manage apt 
 repos):

 dependencies:
>
>   - role: apt
>
> apt_repo:
>
>   - repo_url: "deb https://deb.nodesource.com/node {{ 
>> ansible_distribution_release }} main"
>
> key_id: "68576

Re: [ansible-project] Role dependencies and ansible-galaxy

2014-09-26 Thread James Cammarata
Role dependencies that are not on Galaxy can be listed in the metadata
along with roles that are - however as Michael said, such roles should not
be shared via Galaxy since other users won't have access to them, and the
role will therefore not work.

If you're writing a role for personal use however, you can list any role
dependencies there that you wish. The commented generated by the CLI tool
when using "init" to create a new role directly simply assumes that the
role will be uploaded to Galaxy, so really the comment should read "# If
you're going to upload this role to Galaxy, be sure to list only
dependencies that are also available via Galaxy".

Hope that clears things up.


On Fri, Sep 26, 2014 at 11:46 AM,  wrote:

> Hi Michael,
>
> Thanks for your response.
>
> Absolutely, I understand that Galaxy is not a private content store – this
> is exactly what I'm trying to avoid. I think there might be confusion when
> I say galaxy the tool vs galaxy the service.
>
> I'm using ansible-galaxy as a role depsolver to download roles from
> private GitHub repositories, and occasionally from Galaxy (the service).
> Because Ansible itself seems to understand meta/main.yml in that it'll
> include any dependencies listed there in a run, it seemed like it could be
> used for non-galaxy roles (ie private roles). Since this happens
> automatically within Ansible, it is very useful to include both public and
> private roles in the meta directory.
>
> If it isn't intended to use the meta directory to list both open source
> and internal deps, is there a functionally equivalent alternative?
>
> Thanks.
>
>
>
> On Friday, September 26, 2014 5:15:59 AM UTC-7, Michael DeHaan wrote:
>>
>> "Is that a hard rule, that you can't add dependencies via the
>> meta/main.yml workflow? "
>>
>> Right, That's the only way you add dependencies.
>>
>> What that was saying is roles on galaxy should have all their
>> dependencies on galaxy, else the role should *not* be on galaxy.
>>
>> Why?  Because it's totally wrong to be sharing content with people they
>> can't use :)
>>
>> Galaxy is not a place for personal private content, it's a place to share
>> content with other OSS users.
>>
>>
>>
>>
>> On Fri, Sep 26, 2014 at 4:06 AM,  wrote:
>>
>>> Hi there,
>>>
>>> I'm currently using the in-development 1.8 version of Ansible to get
>>> access to the enhanced requirements.yml features for the ansible-galaxy
>>> command line tool. I'm using it to install roles from GitHub with the
>>> appropriate config, and for the most part everything is working OK.
>>> However, a few times I've ran into issues working with roles I've created
>>> that have meta/main.yml dependencies specified.
>>>
>>> Until about an hour ago, when setting up a test case to replicate the
>>> problem I am running into, I wasn't aware of the comment that is generated
>>> in meta/main.yml when you do ansible-galaxy init – "  # List your role
>>> dependencies here, one per line. Only dependencies available via galaxy
>>> should be listed here. Be sure to remove the '[]' above if you add
>>> dependencies to this list."
>>>
>>> Is that a hard rule, that you can't add dependencies via the
>>> meta/main.yml workflow? I've actually been structuring some of my roles
>>> around the functionality of adding a dependency in another role and
>>> specifying variables, unaware that meta/main.yml dependencies are only for
>>> galaxy resolution. I'd just like some clarification on this, and maybe
>>> thoughts around an alternative workflow if I shouldn't be using role
>>> dependencies this way.
>>>
>>> The problem I encountered before discovering this was that
>>> ansible-galaxy would fail to install roles from the requirements.yml if
>>> they had a meta/main.yml dependency specified that wasn't from galaxy – I
>>> guess I had been relying on what was on the local filesystem and what the
>>> tool downloaded.
>>>
>>> An example of how some of my dependencies are being used (this is from a
>>> role to install nodejs, calling another role I've created to manage apt
>>> repos):
>>>
>>> dependencies:

   - role: apt

 apt_repo:

   - repo_url: "deb https://deb.nodesource.com/node {{
> ansible_distribution_release }} main"

 key_id: "68576280"

 key_url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key";


>>> Let me know if I wasn't clear enough or you have any questions. Any
>>> feedback would be greatly appreciated.
>>>
>>> Thanks for your time.
>>>
>>>
>>>  --
>>> 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-proje...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/ansible-project/82fca86e-3e05-40e9-968d-
>>> 370b7a613e45%40googlegroups.com

Re: [ansible-project] Role dependencies and ansible-galaxy

2014-09-26 Thread seaspicy
Hi Michael,

Thanks for your response. 

Absolutely, I understand that Galaxy is not a private content store – this 
is exactly what I'm trying to avoid. I think there might be confusion when 
I say galaxy the tool vs galaxy the service.

I'm using ansible-galaxy as a role depsolver to download roles from private 
GitHub repositories, and occasionally from Galaxy (the service). Because 
Ansible itself seems to understand meta/main.yml in that it'll include any 
dependencies listed there in a run, it seemed like it could be used for 
non-galaxy roles (ie private roles). Since this happens automatically 
within Ansible, it is very useful to include both public and private roles 
in the meta directory.

If it isn't intended to use the meta directory to list both open source and 
internal deps, is there a functionally equivalent alternative?

Thanks.



On Friday, September 26, 2014 5:15:59 AM UTC-7, Michael DeHaan wrote:
>
> "Is that a hard rule, that you can't add dependencies via the 
> meta/main.yml workflow? "
>
> Right, That's the only way you add dependencies.
>
> What that was saying is roles on galaxy should have all their dependencies 
> on galaxy, else the role should *not* be on galaxy.
>
> Why?  Because it's totally wrong to be sharing content with people they 
> can't use :)
>
> Galaxy is not a place for personal private content, it's a place to share 
> content with other OSS users.
>
>
>
>
> On Fri, Sep 26, 2014 at 4:06 AM, > wrote:
>
>> Hi there,
>>
>> I'm currently using the in-development 1.8 version of Ansible to get 
>> access to the enhanced requirements.yml features for the ansible-galaxy 
>> command line tool. I'm using it to install roles from GitHub with the 
>> appropriate config, and for the most part everything is working OK. 
>> However, a few times I've ran into issues working with roles I've created 
>> that have meta/main.yml dependencies specified. 
>>
>> Until about an hour ago, when setting up a test case to replicate the 
>> problem I am running into, I wasn't aware of the comment that is generated 
>> in meta/main.yml when you do ansible-galaxy init – "  # List your role 
>> dependencies here, one per line. Only dependencies available via galaxy 
>> should be listed here. Be sure to remove the '[]' above if you add 
>> dependencies to this list."
>>
>> Is that a hard rule, that you can't add dependencies via the 
>> meta/main.yml workflow? I've actually been structuring some of my roles 
>> around the functionality of adding a dependency in another role and 
>> specifying variables, unaware that meta/main.yml dependencies are only for 
>> galaxy resolution. I'd just like some clarification on this, and maybe 
>> thoughts around an alternative workflow if I shouldn't be using role 
>> dependencies this way.
>>
>> The problem I encountered before discovering this was that ansible-galaxy 
>> would fail to install roles from the requirements.yml if they had a 
>> meta/main.yml dependency specified that wasn't from galaxy – I guess I had 
>> been relying on what was on the local filesystem and what the tool 
>> downloaded. 
>>
>> An example of how some of my dependencies are being used (this is from a 
>> role to install nodejs, calling another role I've created to manage apt 
>> repos):
>>
>> dependencies:
>>>
>>>   - role: apt
>>>
>>> apt_repo:
>>>
>>>   - repo_url: "deb https://deb.nodesource.com/node {{ 
 ansible_distribution_release }} main"
>>>
>>> key_id: "68576280"
>>>
>>> key_url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key";
>>>
>>>
>> Let me know if I wasn't clear enough or you have any questions. Any 
>> feedback would be greatly appreciated. 
>>
>> Thanks for your time.  
>>   
>>
>>  -- 
>> 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-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/82fca86e-3e05-40e9-968d-370b7a613e45%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/9a0ae95a-5a6a-4f95-9534-735c2b80ec7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Role dependencies and ansible-galaxy

2014-09-26 Thread Michael DeHaan
"Is that a hard rule, that you can't add dependencies via the meta/main.yml
workflow? "

Right, That's the only way you add dependencies.

What that was saying is roles on galaxy should have all their dependencies
on galaxy, else the role should *not* be on galaxy.

Why?  Because it's totally wrong to be sharing content with people they
can't use :)

Galaxy is not a place for personal private content, it's a place to share
content with other OSS users.




On Fri, Sep 26, 2014 at 4:06 AM,  wrote:

> Hi there,
>
> I'm currently using the in-development 1.8 version of Ansible to get
> access to the enhanced requirements.yml features for the ansible-galaxy
> command line tool. I'm using it to install roles from GitHub with the
> appropriate config, and for the most part everything is working OK.
> However, a few times I've ran into issues working with roles I've created
> that have meta/main.yml dependencies specified.
>
> Until about an hour ago, when setting up a test case to replicate the
> problem I am running into, I wasn't aware of the comment that is generated
> in meta/main.yml when you do ansible-galaxy init – "  # List your role
> dependencies here, one per line. Only dependencies available via galaxy
> should be listed here. Be sure to remove the '[]' above if you add
> dependencies to this list."
>
> Is that a hard rule, that you can't add dependencies via the meta/main.yml
> workflow? I've actually been structuring some of my roles around the
> functionality of adding a dependency in another role and specifying
> variables, unaware that meta/main.yml dependencies are only for galaxy
> resolution. I'd just like some clarification on this, and maybe thoughts
> around an alternative workflow if I shouldn't be using role dependencies
> this way.
>
> The problem I encountered before discovering this was that ansible-galaxy
> would fail to install roles from the requirements.yml if they had a
> meta/main.yml dependency specified that wasn't from galaxy – I guess I had
> been relying on what was on the local filesystem and what the tool
> downloaded.
>
> An example of how some of my dependencies are being used (this is from a
> role to install nodejs, calling another role I've created to manage apt
> repos):
>
> dependencies:
>>
>>   - role: apt
>>
>> apt_repo:
>>
>>   - repo_url: "deb https://deb.nodesource.com/node {{
>>> ansible_distribution_release }} main"
>>
>> key_id: "68576280"
>>
>> key_url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key";
>>
>>
> Let me know if I wasn't clear enough or you have any questions. Any
> feedback would be greatly appreciated.
>
> Thanks for your time.
>
>
>  --
> 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/82fca86e-3e05-40e9-968d-370b7a613e45%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgyTOsGeO-3zTHDMNWtf4%3DdL8OfMxULa3vySLG9BWu%3D7og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Role Dependencies and var_files

2013-11-28 Thread Michael DeHaan
Public service announcement:

Please do not use old style variables.

Ansible 1.4 is already sharing deprecation warnings about this.

user: "{{ user }}"






On Thu, Nov 28, 2013 at 3:09 PM, Frédéric Badel  wrote:

> Hi,
>
> I don’t know what you’re trying to achieve exactly … but assuming that all
> your vhosts have the same configuration file structure, you could use a
> template and to something like below:
>
> roles/
> webservers/
> tasks/main.yml
> vars/main.yml
> templates/vhost.conf.j2
>
> playbook:
> ***
> —
> hosts: my_servers
> roles:
> - { role: webservers, vhost_name: www.sitea.com, vhost_root:
> /var/www/sitea }
> - { role: webservers, vhost_name: www.siteb.com, vhost_root:
> /var/www/siteb }
>
> task/main.yml:
> 
> —
> - name: copy vhost config
>   template: dest=/etc/httpd/conf.d/{{ vhost_name }}.conf src=vhost.conf.j2
>   sudo: yes
>
> templates/vhost.conf.j2:
> 
> 
> DocumentRoot {{ vhost_root }}
> ServerName {{ vhost_name }}
> 
>
> cheers,
>
> fred
>
> On Nov 28, 2013, at 18:53 , Shih Oon Liong 
> wrote:
>
> I didn't realized about the parameterized roles. I'll give that go! But
> that also cleared up on what role dependencies was suppose to be for.
>
> What I am try to do though is to load up a different config file instead
> so that instead of me trying to do
>
> var_files
>- config_file
> role:
> - { role: webservers, servername: www.site1.com, documentroot:
> /var/www/site1 }
> - { role: webservers, servername: www.siteB.com ,
> documentroot: /var/www2/siteB }
>
> I can do something like
>
> var_files
>- config_file
> role:
> - { role: webservers, [ Config file 1] }
> - { role: webservers, [ Config file 2] }
>
> Though I guess maybe the var_files should be in the roles itself perhaps?
> I could try to make my role take in either individual vars or if a
> var_files is defined, to use that instead?
>
> On Thursday, November 28, 2013 5:09:06 AM UTC-8, Fred Badel wrote:
>>
>> Hi,
>>
>> You can use parameterized roles …
>> I use the following to create several DB using one role (roughly):
>>
>> roles/create_db/tasks/main.yml:
>>
>> - name: create {{ db_name }}
>>   mysql_db: name={{ db_name }} encoding=utf8 login_user=root
>> state=present login_password={{ mysql_root_password }}
>>
>> then it is called as follow in the playbook:
>>
>> - hosts: db_server
>>   roles:
>>   - { role: create_db, db_name: DB_1 }
>>   - { role: create_db, db_name: DB_2 }
>>   - { role: create_db, db_name: DB_3 }
>>
>>
>> Typically, for an apache vhost configuration, you could pass the value of
>> “servername" and “documentroot” to the webserver role like this
>>
>> role:
>> - { role: webservers, servername: www.site1.com, documentroot:
>> /var/www/site1 }
>> - { role: webservers, servername: www.siteB.com ,
>> documentroot: /var/www2/siteB }
>>
>> - note 1:
>> you should be using {{ my_var }} instead of $my_var
>>
>> -note 2:
>> you are mentioning role dependencies, which is meant to configure…
>> dependencies between roles (ie the role webservers requires the role
>> common) and I am not sure that it is related to you question http://www.
>> ansibleworks.com/docs/playbooks_roles.html#role-dependencies
>>
>> HTH
>>
>> Fred
>>
>> On Nov 28, 2013, at 13:37 , Shih Oon Liong 
>> wrote:
>>
>> Hi,
>>
>> I am kinda confused on what is the right syntax to try out this. Running
>> a role multiple times in a single playbok but a different var_files each
>> time.
>>
>> I have a web server role for a LAMP stack that will also install the
>> Apache vhost site. My idea was that I can run this role on the same server
>> if I was installing multiple sites - Ansible would just skip the software
>> installations but just install the vhost configs.
>>
>> This works fine if I run the playbook multiple times manually. What I
>> want to do is to do this multiple times in one single playbook. My
>> assumption is that I should be using Role Dependencies (amirite?).
>>
>> My current playbook *roughly*
>>
>> ---
>> # Deployment for web servers
>> #
>> - hosts: $hosts
>>   user: $user
>>   sudo: true
>>   name: Install Apache and PHP.
>>   vars_files:
>> - $config_path
>>
>>   roles:
>> - common
>> - webservers
>>
>>
>> As you can see, I heavily use vars_files since I find configs to be in a
>> separate file much easier to manage.
>>
>> What I am confused is how can I use role dependencies but load up a
>> different var_files each time round? The example in the documentation seems
>> to imply just individual variable replacements but my webservers role has
>> several variables that need to be set for a site install which will make it
>> unwieldy.
>>
>> Any help is much appreciated. Thanks!
>>
>>
>>
>>
>> Invoke Labs – A business building company that equips new digital
>> ventures for long term success.
>> Twitter  | 
>> Facebook
>>  | LinkedIn 

Re: [ansible-project] Role Dependencies and var_files

2013-11-28 Thread Frédéric Badel
Hi,

I don’t know what you’re trying to achieve exactly … but assuming that all your 
vhosts have the same configuration file structure, you could use a template and 
to something like below:

roles/
webservers/
tasks/main.yml
vars/main.yml
templates/vhost.conf.j2

playbook:
***
— 
hosts: my_servers
roles:
- { role: webservers, vhost_name: www.sitea.com, vhost_root: 
/var/www/sitea }
- { role: webservers, vhost_name: www.siteb.com, vhost_root: 
/var/www/siteb }

task/main.yml:

—
- name: copy vhost config
  template: dest=/etc/httpd/conf.d/{{ vhost_name }}.conf src=vhost.conf.j2
  sudo: yes

templates/vhost.conf.j2:


DocumentRoot {{ vhost_root }}
ServerName {{ vhost_name }}


cheers,

fred

On Nov 28, 2013, at 18:53 , Shih Oon Liong  wrote:

> I didn't realized about the parameterized roles. I'll give that go! But that 
> also cleared up on what role dependencies was suppose to be for.
> 
> What I am try to do though is to load up a different config file instead so 
> that instead of me trying to do 
> 
> var_files
>- config_file
> role:
>   - { role: webservers, servername: www.site1.com, documentroot: 
> /var/www/site1 }
>   - { role: webservers, servername: www.siteB.com, documentroot: 
> /var/www2/siteB }
> 
> I can do something like 
> 
> var_files
>- config_file
> role:
>   - { role: webservers, [ Config file 1] }
>   - { role: webservers, [ Config file 2] }
> 
> Though I guess maybe the var_files should be in the roles itself perhaps? I 
> could try to make my role take in either individual vars or if a var_files is 
> defined, to use that instead?
> 
> On Thursday, November 28, 2013 5:09:06 AM UTC-8, Fred Badel wrote:
> Hi,
> 
> You can use parameterized roles …
> I use the following to create several DB using one role (roughly):
> 
> roles/create_db/tasks/main.yml:
> 
> - name: create {{ db_name }}
>   mysql_db: name={{ db_name }} encoding=utf8 login_user=root state=present 
> login_password={{ mysql_root_password }}
> 
> then it is called as follow in the playbook:
> 
> - hosts: db_server
>   roles:
>   - { role: create_db, db_name: DB_1 }
>   - { role: create_db, db_name: DB_2 }
>   - { role: create_db, db_name: DB_3 }
> 
> 
> Typically, for an apache vhost configuration, you could pass the value of 
> “servername" and “documentroot” to the webserver role like this
> 
> role:
>   - { role: webservers, servername: www.site1.com, documentroot: 
> /var/www/site1 }
>   - { role: webservers, servername: www.siteB.com, documentroot: 
> /var/www2/siteB }
> 
> - note 1:
> you should be using {{ my_var }} instead of $my_var
> 
> -note 2:
> you are mentioning role dependencies, which is meant to configure… 
> dependencies between roles (ie the role webservers requires the role common) 
> and I am not sure that it is related to you question 
> http://www.ansibleworks.com/docs/playbooks_roles.html#role-dependencies 
> 
> HTH
> 
> Fred
> 
> On Nov 28, 2013, at 13:37 , Shih Oon Liong  wrote:
> 
>> Hi,
>> 
>> I am kinda confused on what is the right syntax to try out this. Running a 
>> role multiple times in a single playbok but a different var_files each time.
>> 
>> I have a web server role for a LAMP stack that will also install the Apache 
>> vhost site. My idea was that I can run this role on the same server if I was 
>> installing multiple sites - Ansible would just skip the software 
>> installations but just install the vhost configs.
>> 
>> This works fine if I run the playbook multiple times manually. What I want 
>> to do is to do this multiple times in one single playbook. My assumption is 
>> that I should be using Role Dependencies (amirite?).
>> 
>> My current playbook *roughly*
>> 
>> ---
>> # Deployment for web servers
>> # 
>> - hosts: $hosts
>>   user: $user
>>   sudo: true
>>   name: Install Apache and PHP.
>>   vars_files:
>> - $config_path
>> 
>>   roles:
>> - common
>> - webservers
>> 
>> 
>> As you can see, I heavily use vars_files since I find configs to be in a 
>> separate file much easier to manage. 
>> 
>> What I am confused is how can I use role dependencies but load up a 
>> different var_files each time round? The example in the documentation seems 
>> to imply just individual variable replacements but my webservers role has 
>> several variables that need to be set for a site install which will make it 
>> unwieldy.
>> 
>> Any help is much appreciated. Thanks!
>> 
>> 
>> 
>> 
>> Invoke Labs – A business building company that equips new digital ventures 
>> for long term success.
>> Twitter | Facebook | LinkedIn | Blog | 
>> 
>> Check out the latest products from Invoke Labs: Pendo Rent and myBestHelper.
>> 
>> -- 
>> 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 

Re: [ansible-project] Role Dependencies and var_files

2013-11-28 Thread Shih Oon Liong
I didn't realized about the parameterized roles. I'll give that go! But 
that also cleared up on what role dependencies was suppose to be for.

What I am try to do though is to load up a different config file instead so 
that instead of me trying to do 

var_files
   - config_file
role:
- { role: webservers, servername: www.site1.com, documentroot: 
/var/www/site1 }
- { role: webservers, servername: www.siteB.com , 
documentroot: /var/www2/siteB }

I can do something like 

var_files
   - config_file
role:
- { role: webservers, [ Config file 1] }
- { role: webservers, [ Config file 2] }

Though I guess maybe the var_files should be in the roles itself perhaps? I 
could try to make my role take in either individual vars or if a var_files 
is defined, to use that instead?

On Thursday, November 28, 2013 5:09:06 AM UTC-8, Fred Badel wrote:
>
> Hi,
>
> You can use parameterized roles …
> I use the following to create several DB using one role (roughly):
>
> roles/create_db/tasks/main.yml:
>
> - name: create {{ db_name }}
>   mysql_db: name={{ db_name }} encoding=utf8 login_user=root state=present 
> login_password={{ mysql_root_password }}
>
> then it is called as follow in the playbook:
>
> - hosts: db_server
>   roles:
>   - { role: create_db, db_name: DB_1 }
>   - { role: create_db, db_name: DB_2 }
>   - { role: create_db, db_name: DB_3 }
>
>
> Typically, for an apache vhost configuration, you could pass the value of 
> “servername" and “documentroot” to the webserver role like this
>
> role:
> - { role: webservers, servername: www.site1.com, documentroot: 
> /var/www/site1 }
> - { role: webservers, servername: www.siteB.com, documentroot: 
> /var/www2/siteB }
>
> - note 1:
> you should be using {{ my_var }} instead of $my_var
>
> -note 2:
> you are mentioning role dependencies, which is meant to configure… 
> dependencies between roles (ie the role webservers requires the role 
> common) and I am not sure that it is related to you question 
> http://www.ansibleworks.com/docs/playbooks_roles.html#role-dependencies 
>
> HTH
>
> Fred
>
> On Nov 28, 2013, at 13:37 , Shih Oon Liong 
> > 
> wrote:
>
> Hi,
>
> I am kinda confused on what is the right syntax to try out this. Running a 
> role multiple times in a single playbok but a different var_files each time.
>
> I have a web server role for a LAMP stack that will also install the 
> Apache vhost site. My idea was that I can run this role on the same server 
> if I was installing multiple sites - Ansible would just skip the software 
> installations but just install the vhost configs.
>
> This works fine if I run the playbook multiple times manually. What I want 
> to do is to do this multiple times in one single playbook. My assumption is 
> that I should be using Role Dependencies (amirite?).
>
> My current playbook *roughly*
>
> ---
> # Deployment for web servers
> # 
> - hosts: $hosts
>   user: $user
>   sudo: true
>   name: Install Apache and PHP.
>   vars_files:
> - $config_path
> 
>   roles:
> - common
> - webservers
>
>
> As you can see, I heavily use vars_files since I find configs to be in a 
> separate file much easier to manage. 
>
> What I am confused is how can I use role dependencies but load up a 
> different var_files each time round? The example in the documentation seems 
> to imply just individual variable replacements but my webservers role has 
> several variables that need to be set for a site install which will make it 
> unwieldy.
>
> Any help is much appreciated. Thanks!
>
>
>
>
> Invoke Labs – A business building company that equips new digital ventures 
> for long term success.
> Twitter  | 
> Facebook
>  | LinkedIn  | 
> Blog
>  | 
>
> *Check out the latest products from Invoke Labs 
> : Pendo Rent 
>  and myBestHelper .*
>
> -- 
> 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-proje...@googlegroups.com .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
-- 
Invoke Labs – A business building company that equips new digital ventures 
for long term success.
Twitter  | 
Facebook
 | LinkedIn  | 
Blog
 | 

*Check out the latest products from Invoke Labs 
: Pendo Rent 
 and myBestHelper .*

-- 
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 

Re: [ansible-project] Role Dependencies and var_files

2013-11-28 Thread Frédéric Badel
Hi,

You can use parameterized roles …
I use the following to create several DB using one role (roughly):

roles/create_db/tasks/main.yml:

- name: create {{ db_name }}
  mysql_db: name={{ db_name }} encoding=utf8 login_user=root state=present 
login_password={{ mysql_root_password }}

then it is called as follow in the playbook:

- hosts: db_server
  roles:
  - { role: create_db, db_name: DB_1 }
  - { role: create_db, db_name: DB_2 }
  - { role: create_db, db_name: DB_3 }


Typically, for an apache vhost configuration, you could pass the value of 
“servername" and “documentroot” to the webserver role like this

role:
- { role: webservers, servername: www.site1.com, documentroot: 
/var/www/site1 }
- { role: webservers, servername: www.siteB.com, documentroot: 
/var/www2/siteB }

- note 1:
you should be using {{ my_var }} instead of $my_var

-note 2:
you are mentioning role dependencies, which is meant to configure… dependencies 
between roles (ie the role webservers requires the role common) and I am not 
sure that it is related to you question 
http://www.ansibleworks.com/docs/playbooks_roles.html#role-dependencies 

HTH

Fred

On Nov 28, 2013, at 13:37 , Shih Oon Liong  wrote:

> Hi,
> 
> I am kinda confused on what is the right syntax to try out this. Running a 
> role multiple times in a single playbok but a different var_files each time.
> 
> I have a web server role for a LAMP stack that will also install the Apache 
> vhost site. My idea was that I can run this role on the same server if I was 
> installing multiple sites - Ansible would just skip the software 
> installations but just install the vhost configs.
> 
> This works fine if I run the playbook multiple times manually. What I want to 
> do is to do this multiple times in one single playbook. My assumption is that 
> I should be using Role Dependencies (amirite?).
> 
> My current playbook *roughly*
> 
> ---
> # Deployment for web servers
> # 
> - hosts: $hosts
>   user: $user
>   sudo: true
>   name: Install Apache and PHP.
>   vars_files:
> - $config_path
> 
>   roles:
> - common
> - webservers
> 
> 
> As you can see, I heavily use vars_files since I find configs to be in a 
> separate file much easier to manage. 
> 
> What I am confused is how can I use role dependencies but load up a different 
> var_files each time round? The example in the documentation seems to imply 
> just individual variable replacements but my webservers role has several 
> variables that need to be set for a site install which will make it unwieldy.
> 
> Any help is much appreciated. Thanks!
> 
> 
> 
> 
> Invoke Labs – A business building company that equips new digital ventures 
> for long term success.
> Twitter | Facebook | LinkedIn | Blog | 
> 
> Check out the latest products from Invoke Labs: Pendo Rent and myBestHelper.
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.