`ansible-galaxy init --offline ...` can create a role without
talking to the galaxy api server
`ansible-galaxy install ...` only needs to talk to the galaxy api
server for galaxy roles, not tar files or scm archives
Fixed a bug in command line role installation
Older git archive commands create tar archives even with a tar.gz
extension. So change it to always create tar archives and have
the install_role method cope.
Removed ssh roles from the test case as they don't work unless
you can connect to bitbucket via ssh and have your key there.
Corrected a minor typo in error messages
* Roles can now be given a friendly name as third field in role spec csv
* Roles can be installed from URL (not just from archived SCMs)
* Integration tests to demonstrate this
* Unit tests to ensure that role spec parsing works as expected
This addresses a bug in ansible-pull where running ansible-pull
with an existing inventory causes the ansible job that does
the SCM checkout to run twice - once for localhost and once
for the fully qualified hostname.
This can cause a race condition, and usually results in one
of the ansible checkouts failing because one of the scm checkouts
has its references updated underneath it. Although the SCM checkout
actually succeeds, ansible fails with non-zero exit status, and
so ansible-pull does not continue.
Now that localhost is implicit for ansible runs, the ansible
scm checkout can be done using just localhost as a target.
A fairly trivial change since `Role Name` and `Example Playbook`
will likely be modified anyways. However, since all the other
sections are aligned properly, felt it would be nice to "clean this up".
Before:
Role Name
========
Example Playbook
-------------------------
After:
Role Name
=========
Example Playbook
----------------
Without this fix you have to enter your vault password before you realize
that you forgot to pass in the filename. This commit checks that an
filename argument was at least passed on the command line.
Split out parsing of vars files to per host and per group
parsing, instead of reparsing all groups for each host. This enhances
performance.
Extend vars_plugins' API with two new methods:
* get host variables: only parses host_vars
* get group variables: only parses group_vars for specific group
The initial run method is still used for backward compatibility.
Parse all vars_plugins at inventory initialisation, instead of
per host when touched first by runner. Here we can also loop through
all groups once easily, then parse them.
This also centralizes all parsing in the inventory constructor.
modified: bin/ansible
modified: bin/ansible-playbook
modified: lib/ansible/inventory/__init__.py
modified: lib/ansible/inventory/vars_plugins/group_vars.py
And also print to stdout not err
This lines up with how ansible-playbook will exit. 0 in the case of no
matched hosts. This makes it easier to script ansible commands w/
variable iventory input which may or may not have an entry for the
specific ansible task being scripted. No matched hosts is acceptable,
but matched hosts w/ failures is not.
Thi permit to simplify the command line to use by using
a sensible default, and so reduce the number of incorrect
possible choices and setup needed. Among potential
incorrect choices is using a fixed directory in /tmp, which
could be problematic with a setup whose access is not
properly restricted.
For a small network ( home, small company ), having to put the FQDN
in each file is a bit tedious, so this patch also add the shorthostname
as a 3rd default if the fqdn is not found.
If PAGER is set, or the executable less is present, ansible-doc will use
it to pipe information into so that it can be scrolled through.
If the environment variable LESS is not set, this will set it to FRSX.
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.
Provide hints to playbook callers that a playbook execution had
unreachable vs failures. 2 == failures, 3 == no failures, but
unreachable hosts. 0 continues to be all good.
With the command line option "-c local", ansible and ansible-playbook
should never ask for a SSH password even if this is set in the config.
Fixes#3720
* 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.
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.
A recent change to ansible-playbook to support json extra-vars
also inadvertently broke the script when no extra-vars are
provided. Simply checking to make sure it is defined and truthy
should take care of the issue.
And also be liberal in what ansible-doc accepts as an empty
requirements specification.
While here fix a typo in template module documentation
wrt jinja2 overrides example.