I’m not sure if these can be done at the moment, and if not they’d be nice:
-
globbing and directory recursion in the template and copy tasks to do more than one file at a time
-
remote templating and copies: the use case is pulling a source code repository to the remote machine and doing some template-based configuration there from the repository without requiring its presence on the local machine running the playbook
1) globbing and directory recursion in the template and copy tasks to do more than one file at a time
I do this with_xxx all the time, using a fileglob or shell command as
input (find).
2) remote templating and copies: the use case is pulling a source code
repository to the remote machine and doing some template-based configuration
there from the repository without requiring its presence on the local
machine running the playbook
I think you want something in line with ansible-pull or fireball mode
here (with local actions).
2) remote templating and copies: the use case is pulling a source code
repository to the remote machine and doing some template-based configuration
there from the repository without requiring its presence on the local
machine running the playbook
Can you explain the why in your use case in more depth?
It would be easy to orchestrate the local download of that repo prior
to the remote actions.
That's what I will do at the start, but here's the issue:
I want the devops portion to be light and quick, and runnable from any machine with Python and ansible installed. The source code repository will contain a large number of static files and what not that I'd rather not have to download to a management machine.
The use case is Django configuration files. I don't want to keep them in the Ansible repo: they're .py files with some code and such. In my opinion they belong with the application itself, not the Ansible scripts. Also, I have dreams of creating a set of generic Django Ansible setup scripts and I don't think app-specific configuration belongs in them. nginx files are one thing; they're pretty generic and can be handled with some simple substitution for the most part, but not app config.
So the idea is to use Ansible to set up the app server, then on deploy Ansible will pull the latest repo of application code and static files onto the remote machine. There are Django settings templates in that repo (for dev, staging, and production). Ansible would then template the necessary files out of the application repo into a spot where the executing uwsgi server can see them.
It also removes a git pull (for the local machine). Going on to the remote copy, the same thing applies: if I want to move things around from the application repo into other places on the remote machine, it's best not to have to copy them over the wire if I've already pulled them elsewhere.
Make sense?
Regards,
-scott
Cool, thanks. I forgot about with_fileglob. That's exactly what I need.
Regards,
-scott