Commit graph

441 commits

Author SHA1 Message Date
Brian Coca
ddb3764039
avoid empty groups in json output (#45621)
they get confused as hosts by script plugin

fixes #45601
2018-09-13 15:38:52 -04:00
Daniel Nägele
edaa0b5245 ansible-pull: allow specifying --diff from check_opts cli flag group (#37645) 2018-08-28 15:15:14 -04:00
Toshio Kuratomi
0873d46617 Fix ansible-doc and docsite generation for removed modules
* Fix ansible-doc wrt removed modules
  * Fix listing of modules ia ansible-doc to not complain about removed modules
    Removed modules are marked as such in the metadata but nowhere else.
    Need to retrieve the metadata when a module doesn't have a doc so that
    we can tell if it falls under this case.
  * omit removed modules from json dump
  * Print an error that the module has been removed if attempting to run
    ansible-doc on that specific module

* Get plugin_formatter to stop outputting removed modules
2018-08-24 15:37:13 -07:00
Matt Martz
aa07da21a3
Bump sudo/su deprecation to 2.9 (#44581) 2018-08-23 13:22:54 -05:00
Sam Doran
05fff27415
Pass path to GalaxyRole object (#43051)
This will list all roles in all paths in roles_path rather than just the first path in roles_path.
2018-08-23 12:44:48 -04:00
Toshio Kuratomi
0e7b470a01 Remove deprecated tags config option (#44479)
* Remove deprecated tags config option

* wordsmith porting guide entry

acozine via github
2018-08-21 14:57:06 -05:00
Matt Martz
617372f8c0
Mass nuke deprecated items that are easily removed. ci_complete (#44320) 2018-08-20 16:26:10 -05:00
Toshio Kuratomi
734384b91d Fix config manager to show errors
If there were fatal bugs in this portion of config, they would never be displayed
because config would fail to load and then every^U (Exageration... only
half of every) other part of the code which depended on config to be
loaded would fail before we ever got around to a section of code that
would process UNABLE.

Remove the try except from here so that we are able to debug this code
2018-08-01 19:42:35 -07:00
joren485
d03b9eddf6 Remove unused imports from /bin and lib/ansible/cli (#43440)
* Remove unused imports from lib/ansible/cli

* Remove unused imports from bin/
2018-07-30 18:55:42 -07:00
Eric Rinish
551501f326 use faster method to get short_description from DOCUMENTATION (#42705)
* use faster method to get short_description from DOCUMENTATION

* fixed pep8 whitespace

* fixed blank line
2018-07-27 17:27:44 -04:00
Brian Coca
917b6b0d09 import_playbook is not usable from inside a play
(cherry picked from commit 55dddf530ad094810929823f80c4546e97a69ac7)
2018-07-24 13:25:12 -04:00
Brian Coca
ac1f05478e Allow to specifically customize console's color 2018-07-24 13:21:58 -04:00
Matt Martz
35b4b1923d Allow adhoc to execute includes and imports 2018-07-23 11:59:12 -04:00
Toshio Kuratomi
ccbac66128 Revert "Make ansible doesn't parse template-like password in user's input (#42275)"
This reverts commit de40ac02a5.

Passwords from the cli need to remain bytes on input otherwise we have
encoding problems when users input non-utf8
2018-07-11 09:30:42 -07:00
Zhikang Zhang
de40ac02a5
Make ansible doesn't parse template-like password in user's input (#42275)
NOTE:
1. Use unsafe decorator but not builtin escape wrapper in jinja2
since ansible will try parse ssh password twice, the builtin
escape wrapper will be removed during the first parse.
2. Use class AnsibleUnsafeText but not '!unsafe' syntax since
passwords are not loaded by YAML env, '!unsafe' syntax doesn't
work for them.
2018-07-05 10:26:12 -04:00
Brian Coca
de0e11c0d5 avoid loading vars on unspecified basedir (cwd) (#42067)
* avoid loading vars on unspecified basedir (cwd)
2018-06-29 16:45:38 -07:00
Luke Short
5024b4e445 Update the minimum Ansible version to 2.4. (#41989) 2018-06-27 15:29:32 -04:00
Brian Coca
2affb5f729 doc fix 2018-06-21 16:30:33 -04:00
Brian Coca
05a49d6eb6
handle groups correctly when they are 'null' (#41698)
* handle groups correctly when they are 'null'

 - even if defined as mapping but having no keys, objects shoudl still be processed correctly
 - also add ansilbe_verbosity to vars not to display in ansible-inventory

fixes #41692
2018-06-20 11:26:46 -04:00
Abhijeet Kasurde
f21307da91 Add more info related to galaxy sub commands (#41085)
Fixes: #17469

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-06-15 12:12:13 -04:00
Matt Davis
25ab2a8153
fix truncated list functions in ansible-doc (#41281)
* fixed incomplete refactor of instance-level plugin list var
2018-06-07 15:07:21 -07:00
Matt Davis
087efe4232
fix ansible-doc regression from missing plugins (#41167) 2018-06-06 10:18:53 -07:00
Abhijeet Kasurde
63d993e07f Minor typos in galaxy cli (#41083)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-06-06 08:39:55 +02:00
Ben Thomasson
01e1b51e33 Fix typo in the ansible-inventory --host error (#41142) 2018-06-05 20:03:27 +02:00
Matt Davis
096d243526 adds ansible-doc JSON plugin data dump
* used for changelog generation of new plugins
2018-06-04 17:20:33 -07:00
Brian Coca
c86fd6e2df Fix error reporting on bad type for config setting 2018-06-01 12:28:30 -04:00
Brian Coca
73b9892605 add keywords handling to ansible-doc
also add check for sequence of string types before we force a join
2018-05-23 14:09:02 -04:00
Brian Coca
cbb6a7f4e8
Enabled unsafe and vault in JSON (#38759)
* allow to load json marked as unsafe or vault

 * centralized json code/decode, add vault support
 * use generics to allow for more varied inputs
 * allow inventory to dump vault w/o decrypting
 * override simplejson also
 * add entry for unsafe also
 * load vaulted and unsafe json, support unvaulting if secrets provided
2018-05-09 14:01:51 -04:00
Lars Kellogg-Stedman
ebe7666d71 add 'localhost_warning' configuration option
Add the 'localhost_warning' configuration option. When set to 'false',
this will prevent Ansible from issuing a warning when the inventory is
empty and it is using an implicit inventory with only 'localhost'.

Closes #17086
2018-04-30 13:27:32 -04:00
Brian Coca
e4dbabbef2 make individual bad paths a warning
still error if none of the paths provided was usable

fixes #39044
2018-04-23 15:17:22 -04:00
Matt Clay
c262dbfd30 Use https for links to ansible.com domains. 2018-04-23 11:33:56 -07:00
Brian Coca
265d838ec9 fix displaying group vars in graph 2018-04-16 15:24:31 -04:00
Brian Coca
bdbb89378f
centralize doc/config plugin lists (#38775)
* centralize doc/config plugin lists

also update list for generation in docsite
added note to ensure they are in sync

* updated shell page to list plugins

added some more docs hinting at plugins being configurable

* fix edit link for plugins
2018-04-16 09:29:49 -04:00
Brian Coca
1b9879ccbf remove unused optoins from inventory cli
fixes #31929
2018-04-05 18:40:24 -04:00
Adrian Likins
6e737c8cb6
Fix 'New Vault password' on vault 'edit' (#35923)
* Fix 'New Vault password' on vault 'edit'

ffe0ddea96 introduce a
change on 'ansible-vault edit' that tried to check
for --encrypt-vault-id in that mode. But '--encrypt-vault-id'
is not intended for 'edit' since the 'edit' should always
reuse the vault secret that was used to decrypt the text.

Change cli to not check for --encrypt-vault-id on 'edit'.

VaultLib.decrypt_and_get_vault_id() was change to return
the vault secret used to decrypt (in addition to vault_id
and the plaintext).

VaultEditor.edit_file() will now use 'vault_secret_used'
as returned from decrypt_and_get_vault_id() so that
an edited file always gets reencrypted with the same
secret, regardless of any vault id configuration or
cli options.

Fixes #35834
2018-03-27 14:12:21 -04:00
Toshio Kuratomi
b98ad3a12b Compare byte strings to byte strings
* Fix a traceback in ansible-pull on python3 comparing output from
  subprocess with a text string.
* Rename variables that hold byte strings so we are clear that those are
  not text strings.
* Use to_text() to transform variable that's being displayed as it's
  less fragile than str().

Fixes #36962
2018-03-20 12:04:05 -07:00
Victor da Costa
cb53b717a4 Ansible Galaxy: skel for network role #37241 (#37251)
* Skel for network role (#37241)

Skel and boilerplate for network role.

* Add network option as valid type
2018-03-09 13:31:27 -05:00
Dylan Murray
90943a3362 Add APB role_type to ansible-galaxy init (#36789)
* Add APB role_type to ansible-galaxy init

* Add handlers scaffolding

* Fix shippable errors by setting default

* Add unit tests and fix shippable

* Updates init description
2018-03-09 06:50:17 -05:00
Leigh Jenkin
e224039586 Fixes #12353 #20977 adds new option to galaxy cli to preserve scm meta (#34642) 2018-02-21 08:34:44 -05:00
Adrian Likins
810fa7046b Fix ansible-console always asking for vault passwords
ansible-console was calling setup_vault_secrets
twice. Once directly and once via _play_prereqs()

The direct invocation was not setting auto_prompt=False.

However, the direct invocation isn't need at all so
this removes it so only _play_reqs() is used.
That fixes the unrequested vault password
prompting.

Fixes #33027
2018-02-15 15:40:51 -05:00
Brian Coca
3680d65d1d deal with no config for view
fixes #35965
2018-02-14 15:53:40 -05:00
Brian Coca
b403653bd2
Inv export (#36188)
* add export option

* added 'export mode' to ansible-inventory

this optimizes the output for exporting inventory vs representing the 'ansible view'

fixes #30877

* added group priority when needed
2018-02-14 15:45:15 -05:00
Chris Houseknecht
c20beeef37
Apply regex to dir name only (#35744) 2018-02-06 16:39:57 -05:00
John R Barker
a23c95023b
Module deprecation: docs, scheme and tests (#34100)
Enforce module deprecation.
After module has reached the end of it's deprecation cycle we will replace it with a docs stub.

* Replace deprecated modules with docs-only sub
* Use of deprecated past deprecation cycle gives meaningful message (see examples below)
* Enforce documentation.deprecation dict via `schema.py`
* Update `ansible-doc` and web docs to display documentation.deprecation
* Document that structure in `dev_guide`
* Ensure that all modules starting with `_` have a `deprecation:` block
* Ensure `deprecation:` block is only used on modules that start with `_`
* `removed_in` A string which represents when this module needs **deleting**
* CHANGELOG.md and porting_guide_2.5.rst list removed modules as well as alternatives
* CHANGELOG.md links to porting guide index

To ensure that meaningful messages are given to the user if they try to use a module at the end of it's deprecation cycle we enforce the module to contain:
```python
if __name__ == '__main__':
    removed_module()
```
2018-01-30 12:23:52 +00:00
Adrian Likins
ffe0ddea96
add a vault --encrypt-vault-to specify vault id to use for encrypt (#31067)
Enforce that there can be only one --new-vault-id or
--new-vault-password-file and use this instead of
--encrypt-vault-id

* Add a config option for default vault encrypt id
2018-01-22 17:12:10 -05:00
Matt Clay
f9f6080630 Improve handling of ansible-doc sanity errors. 2018-01-17 11:41:01 -08:00
Pilou
217ff4498c ansible-config: add simple tests (#34900)
* Revert "Fix ansible-config with python3 (#34673)"

This reverts commit 2a9daaa45b.

* ansible-config: add simple tests

* Fix ansible-config with python3

* ansible-test: don't quote "unusual" characters
2018-01-17 06:33:33 -08:00
Tristan de Cacqueray
576335e53d Add GALAXY_TOKEN config option (#34621)
This change lets user store token in configuration file or environment to
prevent exposing the secret on the command line.
2018-01-16 07:37:50 -08:00
Brian Coca
bbd6b8bb42 Temporary (#31677)
* allow shells to have per host options, remote_tmp

added language to shell
removed module lang setting from general as  plugins have it now
use get to avoid bad powershell plugin
more resilient tmp discovery, fall back to `pwd`
add shell to docs
fixed options for when frags are only options
added shell set ops in t_e and fixed option frags
normalize tmp dir usag4e

- pass tmpdir/tmp/temp options as env var to commands, making it default for tempfile
- adjusted ansiballz tmpdir
- default local tempfile usage to the configured local tmp
- set env temp in action

add options to powershell
shift temporary to internal envvar/params
ensure tempdir is set if we pass var
ensure basic and url use expected tempdir
ensure localhost uses local tmp
give /var/tmp priority, less perms issues
more consistent tempfile mgmt for ansiballz
made async_dir configurable
better action handling, allow for finally rm tmp
fixed tmp issue and no more tempdir in ballz
hostvarize world readable and admin users
always set shell tempdir
added comment to discourage use of exception/flow control

* Mostly revert expand_user as it's not quite working.

This was an additional feature anyhow.

Kept the use of pwd as a fallback but moved it to a second ssh
connection.  This is not optimal but getting that to work in a single
ssh connection was part of the problem holding this up.

(cherry picked from commit 395b714120522f15e4c90a346f5e8e8d79213aca)

* fixed script and other action plugins

ensure tmpdir deletion
allow for connections that don't support new options (legacy, 3rd party)
fixed tests
2018-01-15 21:15:04 -08:00
Matt Martz
2b66d9966c
Add a config toggle for agnostic become prompts, defaulting to False for the 2.5 release. Fixes #33999 (#34761) 2018-01-12 10:28:46 -06:00