Commit graph

17 commits

Author SHA1 Message Date
Stephen Fromm cc3651592b Extend ansible-pull to support other source repositories
This extends ansible-pull so that it can support using other
source_control modules for checking out a playbook repository
(issue #3372).  This will check to see if the module exists before
it attempts to do the checkout and will exit if the module is not found.
It requires that the module used to check out the repository support the
parameters 'name' and 'version'.  The option -C, --checkout is now
optional and defaults to the module's default behavior for selecting a
branch, tag, or commit value.  For git, this continues to be HEAD.

Other changes include:
* Remove git from help and use generic term(s) where needed.
* Use SortedOptParser from ansible.utils
* More abstraction of common options used between ansible and
  ansible-playbook.
2013-08-20 13:43:26 -05:00
Matt Lesko b37ecb055c set checkout destination directory to be full path
we chdir into this path and read the playbook/inventory if a
non-absolute path is given on the command line, that will fail
2013-07-05 17:57:01 +00:00
Michael DeHaan c2988dfdb0 Merge branch 'option-updates' of git://github.com/jlund/ansible into devel
Conflicts:
	bin/ansible-pull
2013-06-30 19:31:37 -04:00
Stavros Korokithakis 53207ddbdf Add --only-if-changed option. 2013-07-01 00:20:58 +03:00
Joshua Lund dc984d94ac Updates to Ansible command options
* Moved the --list-hosts option that is common to both `ansible` and
  `ansible-playbook` into utils/__init__.py (corrects a FIXME)
* Wrote new help text for the --list-hosts option that makes sense
  for both of the commands that it applies to
* Changed the usage argument in `ansible-playbook` so that it is
  setup in the base_parser method the same way that it is in
  the `ansible` executable
* Updated the help text for several options to correct typos,
  clarify meaning, improve readability, or fix grammatical errors.
  In the case of `ansible-pull`, I changed the help text so that
  it adheres to the same standards as the other executables.
2013-06-26 19:57:31 -06:00
Stephen Fromm 355ab6983c remove errant and unneeded import of ansible.constants 2013-06-01 21:47:38 -07:00
Stephen Fromm 291fb9e944 Help ansible-pull work better in bootstap environment
Add option to specify inventory.  No default is defined since
ansible-playbook already does this and it allows an ansible.cfg in the
git repository to take precedence.
Overall, this should help ansible-pull work with less setup in advance,
which should be helpful in kickstart scenarios.  Much of this was
discussed in issue #2464.
2013-06-01 21:44:52 -07:00
Stephen Fromm 4ae3bee416 Add --limit to calls to ansible and ansible-playbook
--limit takes localhost, FQDN, and 127.0.0.1.
2012-11-11 00:13:59 -08:00
Stephen Fromm 60d3e9f3de Add --purge option to ansible-pull
Removes git checkout after playbook run.
2012-10-12 07:55:22 -07:00
Stephen Fromm 034e8f59ed Clean up auto-selection of playbook and miscellaneous changes
Direct any ansible-pull specific messages to stderr.
Introduce try_playbook() and select_playbook() to remove try/except-y.
2012-10-12 07:55:22 -07:00
Matthew Johnson 0841ed4796 change method of obtaining hostname to match ansible/library/setup 2012-10-12 07:55:22 -07:00
Matthew Johnson 2b24131baa fetch the git repo before trying to find a playbook 2012-10-12 07:55:22 -07:00
Stephen Fromm 788e11f1db Merge commits from copperlight's branch ansible-pull_playbook_parameter branch
Merged commits: 3cd25b5 and ed9fc76.  Some massaging of changes applied.
2012-10-12 07:55:22 -07:00
Michael DeHaan faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
2012-08-06 20:07:02 -04:00
Michael DeHaan a33320d03d Add some comments to ansible-pull and the example playbook 2012-05-01 23:22:23 -04:00
Stephen Fromm 84c9caa805 Simplify ansible-pull to just invoke ansible and ansible-playbook
This eliminates the creation of runner and playbook instances and just
invokes the processes ansible and ansible-playbook.
2012-05-02 09:51:19 -07:00
Stephen Fromm 672794f586 Add ansible-pull
A first stab at a pull-based model for ansible.  This does two things:
    1. Invoke the git module via Runner to set up a git repository on the
       localhost.  It sets up Runner to use transport='local' and forces
       the inventory to just 'localhost'.
    2. Run any playbooks provided.  By default, this wants to run the
       playbook local.yml.  This also sets transport='local' and sets
       the host_list to a list: localhost, fqdn, and hostname.
The reason for setting the host_list and not using override_hosts is
because there may be plays in the playbook that are not meant for a
specific host.  That is, if the git repository is for the entire site
and not host-specific, you don't want to override hosts and apply all
plays to any given host.  This has the downside of potentially running a
play three times if the play is defined for 'hosts: all'.
2012-05-02 09:51:19 -07:00