This may be a useful resource for organization tips:

http://docs.ansible.com/playbooks_best_practices.html

Also, if you haven't seen it already, the ansible-galaxy CLI can be used to
quickly stub out a role with the "init" command.

You may wish to read about role dependencies, however galaxy is not meant
as a way to distribute top level playbooks - in practice, they are seldom
reusable because nobody wants  to install the exact same infrastructure
(you've already made a lot of choices about Sublime and Node), whereas
roles provide a more ideal chunk of reuse.

As for your directory questions try, "{{ playbookdir }}/some_path".








On Sun, Jul 27, 2014 at 10:31 AM, Synaesthete <[email protected]>
wrote:

> I'm working on a small Ansible project that's a little outside its primary
> use-case. I'm automating the generation of new web projects in a Mac OS X
> dev environment. There are two objectives:
>
> 1.) Install all development tools on the local machine
> 2.) Compose various projects based on small component roles/tasks
>
> As a simple example, if you run the main playbook, it will prompt you for
> a project folder, install Sublime Text, NodeJS, etc., and set up all the
> basic files needed to begin working on a new project. Here's a subset of my
> project folder:
>
> ansible-generator
>   |- main.yml <-- Main playbook
>   |- apps
>      |- nodejs
>         |- tasks,vars,defaults,etc.
>      |- sublime
>   |- scaffolds
>      |- git
>      |- node
>      |- vagrant
>   |- install
>      |- dmg.yml
>
>
> Everything under both apps and scaffolds are roles. 'apps' install local
> dev tools, and 'scaffolds' uses templates to set up and modify new project
> files (package.json, Vagrantfile, .gitignore, etc.)
>
> I have a couple questions:
>
> 1.) Could this entire project be turned in to a role itself and be
> distributed on Ansible Galaxy, given its different project layout and
> different use-case? Since this is a project built using lots of small
> sub-roles, how could I run all those dependent roles from tasks/main.yml?
>
> 2.) The roles in the /apps folder need to reference tasks under the
> /install folder. Right now I have to use relative paths like
> "../../../dmg.yml". I'd rather set up a variable further up and just use
> "{{ installers }}/dmg.yml", but without just setting this variable to
> "../../.." What's the best way to get the absolute path to the root of this
> project? The playbook_dir variable always returns "."
>
> 3.) Any other thoughts on organizing my project? Is it reasonable to have
> roles in both /apps and /scaffolds or does this seem unwieldy compared to
> putting everything under a /roles folder?
>
> Thanks! If you'd like to take a closer look at my project you can find it
> here: https://github.com/rvangundy/ansible-generator
>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/647cf28d-77cc-4ebf-84db-ec87659fe0a7%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/647cf28d-77cc-4ebf-84db-ec87659fe0a7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyJgOr9W4ncmU8AjGqvKe%2Bhms667NbDVP-VpR80DEaOwg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to