Re: [ansible-project] Ansible roles stored in Git

2017-09-06 Thread Cev Ing
Am Mittwoch, 6. September 2017 09:56:56 UTC+2 schrieb Dick Visser:
>
>
> [defaults] 
> inventory = ~/ansible/inventory.yml 
> roles_path = ~/ansible/roles 
> filter_plugins = ~/ansible/filters 
>
>
We use dot dirs, which makes it necessary to run all jobs from the Ansible 
directory.

$ grep '\./' ansible.cfg 
inventory  = ./hosts.ini
library= ./library
roles_path= ./roles

We have a repository with all Ansible files and each user using Ansible has 
to check out a private copy of the Ansible directory. This makes it very 
easy to implement changes without affecting other people.

-- 
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/61476af5-b089-4551-87ca-6487cd18c02f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-06 Thread Jean-Yves LENHOF



Le 05/09/2017 à 09:27, Ash Powell a écrit :
>
> Fantastic!
>
> Are there any guides or walkthroughs showing the best/correct way of
> setting this up?
>
> Like I say, I’ve had a search myself but there’s nothing specific that
> I can find.
>

The magic world you have to look for in google is "requirements.yml" ;-)

Two links...

https://opencredo.com/reusing-ansible-roles-with-private-git-repos-and-dependencies/
https://zaiste.net/posts/automatically_install_ansible_galaxy_roles_with_requirements_yml/

Regards,

JYL

-- 
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/d54aa05d-b8c8-2e35-1658-2fe1e01f26a4%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-06 Thread 'J Hawkesworth' via Ansible Project
If I recall from the talk, the suggestion was each role would have a git 
repo of its own, then required roles are loaded using a requirements.yml 
file
Some talk about this pattern here:
https://stackoverflow.com/questions/25230376/how-to-automatically-install-ansible-galaxy-roles

We don't have lots of people updating roles at the moment so we have all 
ansible config in a single source code repo and users pull and update their 
local copies.  As noted you have to change ansible.cfg to pick up roles, 
library and plugins from relative paths but it works ok for us.

On Tuesday, September 5, 2017 at 4:50:57 PM UTC+1, Steve Saner wrote:
>
> On 09/05/2017 10:33 AM, Ash Powell wrote: 
> > I'm not sure that this would work for us as we might have multiple 
> > people using/running the same role so it would need to be a common 
> > location (ie not a home folder) 
>
> In my case I really only have one or two people that would be running 
> ansible, but I have things set up on a role account, so that anyone that 
> needs to would log into the same account. 
>
> Another option, I suppose, would be to include a Makefile or something 
> that "installs" your roles from the git repo to /etc/ansible. 
>
> But really, there wouldn't be anything fundamentally wrong with 
> /etc/ansible/roles itself being a git repository, probably. 
>
> Steve 
>
> -- 
> -- 
> Steven Saner  KD0IJP 
> Andover, Kansas USA 
>

-- 
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/88937761-ce58-4f07-972e-786e6fc9a1d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-06 Thread Dick Visser
On 5 September 2017 at 17:33, Ash Powell  wrote:
> I'm not sure that this would work for us as we might have multiple people
> using/running the same role so it would need to be a common location (ie not
> a home folder)

Storing roles in home directories is not a problem.
I use a similar setup as Steve Saner.
Different users needs to make sure only two things:
1. Check out a git repo into an 'ansible' directory in their home directory.
2. Everyone has the same .ansible.cfg file in his homedirectory.

Relevant for this exercise:

[defaults]
inventory = ~/ansible/inventory.yml
roles_path = ~/ansible/roles
filter_plugins = ~/ansible/filters

You could even store the .ansible.cfg in the git repo and symlink
that, so to keep everyone with the same specs -YMMV.

Dick



-- 
Dick Visser
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

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


Re: [ansible-project] Ansible roles stored in Git

2017-09-05 Thread Steve Saner

On 09/05/2017 10:33 AM, Ash Powell wrote:
I'm not sure that this would work for us as we might have multiple 
people using/running the same role so it would need to be a common 
location (ie not a home folder)


In my case I really only have one or two people that would be running 
ansible, but I have things set up on a role account, so that anyone that 
needs to would log into the same account.


Another option, I suppose, would be to include a Makefile or something 
that "installs" your roles from the git repo to /etc/ansible.


But really, there wouldn't be anything fundamentally wrong with 
/etc/ansible/roles itself being a git repository, probably.


Steve

--
--
Steven Saner  KD0IJP
Andover, Kansas USA

--
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/f6ff981a-f8e0-3470-d884-f146aad893fc%40saner.net.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-05 Thread Ash Powell
I'm not sure that this would work for us as we might have multiple people 
using/running the same role so it would need to be a common location (ie 
not a home folder)

On Tuesday, 5 September 2017 15:51:44 UTC+1, Steve Saner wrote:
>
> On 09/05/2017 09:04 AM, Ash Powell wrote: 
> > Thanks for the links. 
> > 
> > Watching the video, it mentions about storing the Playbook in a Git 
> > repo, but nothing about storing the roles in a Git repo. 
> > 
> > I'm referring to the files that (by default) sit on 
> "/etc/ansible/roles/" 
>
>
> I, personally, don't store anything under /etc/ansible (other than 
> /etc/ansible/ansible.cfg). 
>
> I have a directory in my user home that has the following structure: 
>
> ansible/ 
>- group_vars/ 
>- hsot_vars/ 
>- library/ 
>- roles/ 
>- inventory 
>- playlist1.yml 
>- playlist2.yml 
>... 
>
> This whole directory is a git repository and I cd to that directory 
> before running ansible-playbook. 
>
> So, just like you are suggesting, I can work on the roles or libraries 
> or playlists on a develeopment machine (my workstation) and then I can 
> push the repo and pull it down on the production server from which 
> ansible is normally run. 
>
> I don't know that this is the best way, but it certainly works. 
>
> Steve 
>
> -- 
> -- 
> Steven Saner  KD0IJP 
> Andover, Kansas USA 
>

-- 
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/51b3b25f-e255-4eae-9051-1e19479ff816%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-05 Thread Steve Saner

On 09/05/2017 09:04 AM, Ash Powell wrote:

Thanks for the links.

Watching the video, it mentions about storing the Playbook in a Git 
repo, but nothing about storing the roles in a Git repo.


I'm referring to the files that (by default) sit on "/etc/ansible/roles/"



I, personally, don't store anything under /etc/ansible (other than 
/etc/ansible/ansible.cfg).


I have a directory in my user home that has the following structure:

ansible/
  - group_vars/
  - hsot_vars/
  - library/
  - roles/
  - inventory
  - playlist1.yml
  - playlist2.yml
  ...

This whole directory is a git repository and I cd to that directory 
before running ansible-playbook.


So, just like you are suggesting, I can work on the roles or libraries 
or playlists on a develeopment machine (my workstation) and then I can 
push the repo and pull it down on the production server from which 
ansible is normally run.


I don't know that this is the best way, but it certainly works.

Steve

--
--
Steven Saner  KD0IJP
Andover, Kansas USA

--
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/17c21abd-4b3b-4e60-4a75-033ba6575637%40saner.net.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-05 Thread Ash Powell
Thanks for the links.

Watching the video, it mentions about storing the Playbook in a Git repo, 
but nothing about storing the roles in a Git repo.

I'm referring to the files that (by default) sit on "/etc/ansible/roles/"

-- 
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/bd5e19ab-7d25-4b6f-8b3a-0160c0d91fc0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-05 Thread 'J Hawkesworth' via Ansible Project
Probably lots of 'correct' ways of setting this up, but if you want a 
suggestion of how to start, this is something that Sam Doran talked about 
in his Ansiblefest London talk earlier this year.  The video is 
here: https://www.youtube.com/watch?v=7gEKmsuJr7s=youtu.be

(other interesting presentations 
here: https://www.ansible.com/videos-ansiblefest-london-2017 , by the way).

Hope this helps,

Jon


On Tuesday, September 5, 2017 at 8:27:50 AM UTC+1, Ash Powell wrote:
>
> Fantastic!
>
> Are there any guides or walkthroughs showing the best/correct way of 
> setting this up?
>
> Like I say, I’ve had a search myself but there’s nothing specific that I 
> can find.
>
> On Monday, 4 September 2017 17:46:59 UTC+1, Dick Visser wrote:
>>
>> That's not only possible but highly reconmended as well.
>> Especially if they're subject to change - i think most people here use 
>> roles that are.
>>
>> Dick 
>>
>> On Mon, 4 Sep 2017 at 17:48, Ash Powell  wrote:
>>
>>> This may be a silly question, but I've searched around and can't find 
>>> anyone asking a similar thing.
>>>
>>> Is it possible for Ansible roles to be stored in a source control 
>>> repository (such as Git)?
>>>
>>> Scenario;
>>>
>>> We have an ansible server and currently, all of our roles are stored in 
>>> /etc/ansible/roles
>>> If we want to make a change to a role we ssh onto the ansible server and 
>>> manually edit the file (such as tasks/main.yml)
>>>
>>> Is there a way that we can have these files stored in source control so 
>>> that I can edit the file from my local machine, push into a repo and then 
>>> ansible pulls the files before running the playbook/role?
>>> I know we can store files in a repo and call these files DURING a job 
>>> run, but I want to store the roles themselves in there...
>>>
>>> -- 
>>> 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/5b4a66be-8d23-43c0-a5b8-7df8010e4412%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>> Dick Visser
>> GÉANT
>>
>> Want to join us? We're hiring: https://www.geant.org/jobs
>>
>

-- 
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/9f30f83d-e925-4f02-8e48-fb5b25e97f6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-05 Thread Ash Powell


Fantastic!

Are there any guides or walkthroughs showing the best/correct way of 
setting this up?

Like I say, I’ve had a search myself but there’s nothing specific that I 
can find.

On Monday, 4 September 2017 17:46:59 UTC+1, Dick Visser wrote:
>
> That's not only possible but highly reconmended as well.
> Especially if they're subject to change - i think most people here use 
> roles that are.
>
> Dick 
>
> On Mon, 4 Sep 2017 at 17:48, Ash Powell  
> wrote:
>
>> This may be a silly question, but I've searched around and can't find 
>> anyone asking a similar thing.
>>
>> Is it possible for Ansible roles to be stored in a source control 
>> repository (such as Git)?
>>
>> Scenario;
>>
>> We have an ansible server and currently, all of our roles are stored in 
>> /etc/ansible/roles
>> If we want to make a change to a role we ssh onto the ansible server and 
>> manually edit the file (such as tasks/main.yml)
>>
>> Is there a way that we can have these files stored in source control so 
>> that I can edit the file from my local machine, push into a repo and then 
>> ansible pulls the files before running the playbook/role?
>> I know we can store files in a repo and call these files DURING a job 
>> run, but I want to store the roles themselves in there...
>>
>> -- 
>> 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/5b4a66be-8d23-43c0-a5b8-7df8010e4412%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Dick Visser
> GÉANT
>
> Want to join us? We're hiring: https://www.geant.org/jobs
>

-- 
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/ea49f259-9bc2-4706-87ce-06a34144d2f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible roles stored in Git

2017-09-04 Thread Dick Visser
That's not only possible but highly reconmended as well.
Especially if they're subject to change - i think most people here use
roles that are.

Dick

On Mon, 4 Sep 2017 at 17:48, Ash Powell  wrote:

> This may be a silly question, but I've searched around and can't find
> anyone asking a similar thing.
>
> Is it possible for Ansible roles to be stored in a source control
> repository (such as Git)?
>
> Scenario;
>
> We have an ansible server and currently, all of our roles are stored in
> /etc/ansible/roles
> If we want to make a change to a role we ssh onto the ansible server and
> manually edit the file (such as tasks/main.yml)
>
> Is there a way that we can have these files stored in source control so
> that I can edit the file from my local machine, push into a repo and then
> ansible pulls the files before running the playbook/role?
> I know we can store files in a repo and call these files DURING a job run,
> but I want to store the roles themselves in there...
>
> --
> 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/5b4a66be-8d23-43c0-a5b8-7df8010e4412%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Dick Visser
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

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