Commit graph

15231 commits

Author SHA1 Message Date
Brian Coca
93ac278f4c added 'extensions' options to include_vars
This allows users to override default 'extensions read' when using the dir option
2017-02-22 10:31:22 -05:00
Toshio Kuratomi
45251f910c Make BaseFileCache into an abstractbaseclass so it's a proper interface
Push the opening and closing of files into the _load and _dump methods
so that we don't invoke the slow codec machinery without reason.
2017-02-22 10:27:29 -05:00
Toshio Kuratomi
c033e5111f Graceful error message for abstract base classes in PluginLoader 2017-02-22 10:27:29 -05:00
Brian Coca
374af06cbf added pickle and yaml cache plugins
added new base class for file based cache plugins as 99% of code was common
now also catches unexpected decoding exceptions
allows per module file modes and encoding
moved jsonfile code to base
2017-02-22 10:27:29 -05:00
scottb
3812c76168 Update GUIDELINES.md
Edited for grammar and clarity.
2017-02-22 10:25:42 -05:00
Brian Coca
96d952a998 fix typo 2017-02-22 10:25:42 -05:00
Brian Coca
4bdaf6a4f0 updated guidelines to reflect boto3 preference 2017-02-22 10:25:42 -05:00
Dhivyap
75d7c70e70 Fixes#5534-Handled Command Prompt in exec mode (#21651)
* Fixes#5534-Handled Command Prompt in exec mode

* Pep8 Cleanup
2017-02-22 09:58:21 -05:00
Ricardo Carrillo Cruz
ab4e83f288 Remove superfluous include on iosxr filesystems fact gathering (#21775)
The regex will catch only lines that start with 'Directory of' regardless.
Also, fixing unit tests while at it.
2017-02-22 15:44:17 +01:00
Peter Sprygada
9e6980a039 fixs command dict to be sent to connection socket (#21713)
There as an invalid key in the command dict that would cause failure
using prompts.  This changes the key from response to answer which is
what is expected by network_cli
2017-02-22 09:44:04 -05:00
Adrian Likins
6e7b89764e Fix snmp_facts error on decode_hex() (#21694)
* Fix snmp_facts error on decode_hex()

Remove use of some_string.decode('hex') that fails on py3, and
replace with to_binascii.unhexlify()

Fixes #21668
2017-02-22 09:32:20 -05:00
Matt Martz
b143fdea54 DOC options must be a dict when used with extends_documentation_fragment (#21745)
* Fix string formatting
* Provide better tracebacks
* When options is None and extends_documentation_fragment is in use, add an error that options must be a dict
* If options was specified and not a dict, then error
2017-02-21 17:42:39 -08:00
James Cammarata
404b2864ef Additional lock down of conditionals 2017-02-21 17:49:08 -06:00
Brian Coca
5258e6d52a use safe load instead
fixes #21724
2017-02-21 17:45:46 -05:00
James Cooke
8ec28a2ba4 Download remote apt deb file in bytes mode in Python 2 and 3
Fixes #19710
2017-02-21 14:26:58 -08:00
James Cammarata
9f0b354023 Use proper YAML constructor class for safe loading 2017-02-21 16:23:42 -06:00
Toshio Kuratomi
2dde7f7768 Fix a case where we mixed text and bytes in the local connection plugin
Fixes #20710
2017-02-21 14:19:08 -08:00
Tim Rupp
6a4324ee99 [network] fix imported name in F5 module_utils (#21733)
Whoops. not called that.
2017-02-21 16:40:23 -05:00
Ryan Brown
c136ff58c0 [cloud][docs] Fix misleading Route53 value example (#21689)
The `route53` module uses a comma-separated string for records
containing more than one value. Fixes #21134
2017-02-21 15:48:32 -05:00
James Cammarata
3d65482927 Stash post-validated fields of the task in the TaskResult
This allows us to have a snapshot of the fields, which we can restore
on the pre-fork side so as to avoid having to re-template fields.
2017-02-21 14:35:13 -06:00
jctanner
40235d7b99 Skip fact gathering if the entire play was included via conditional and False (#21734)
Addresses #21528
2017-02-21 14:46:10 -05:00
Pierrick Caillon
a1b3664ec4 Fix: mysql_user - permission string with column privileges
MySQL returns privileges on columns as "PRIVILEGES (column)".
For permissions to be correctly matched, it must be specified exactly the
same in the module argument. A resulting string is like
"dbname.dbtable:PRIVILEGES (column)". Thus, the space before the opening
parenthesis must also be removed when creating the set of privileges for
validation.
2017-02-21 10:51:03 -08:00
Matt Clay
879feff6b7 Fix PEP 8 issue. 2017-02-21 10:24:02 -08:00
Veaceslav Mindru
cdcdc1d81b #19587 add yum skip-broken (#21475)
* #19587: refactor to PEP8

* Issue: #19587: add skip_broken option to yum module
PNTSYSOPS-1901 - internal reference

Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>

* Issue: #19587: fix line break, attempt to make readble

        things at line 646 look ugly ..
        trying to make them look a bit more human readble
        though the entire approach should be rewriten

PNTSYSOPS-1901 - internal reference

Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>

* #19587: fixing typo, skip-broken has to be passed as list

* PR: #21475: peer review changes
            relates to: revert comment deletion https://github.com/ansible/ansible/pull/21475#discussion_r101574146
            relates to: remove irelevant var https://github.com/ansible/ansible/pull/21475#discussion_r101573388
            relates to: reformat https://github.com/ansible/ansible/pull/21475#discussion_r101572840

Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>

* PR: #21475: peer review changes
            relates to: https://github.com/ansible/ansible/pull/21475#discussion_r101573736

Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>

* Issue: #21475: fixing typo in the Man section

Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>

* PR: #21475 - Peer review: revert variable a
        Relates to: https://github.com/ansible/ansible/pull/21475#pullrequestreview-22404868

Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>

* Issue: 19587 - small correction

Signed-off-by: Veaceslav Mindru <vmindru@redhat.com> <mindruv@gmail.com>
2017-02-21 07:59:07 -08:00
Adrian Likins
297566f2fd Wrap vault encrypt_strings zip() result in list for py3 (#21695)
py3 zip() results are not lists, so list'ify the result
for py2/py3 compat.
2017-02-21 10:30:21 -05:00
Damien
6fadddeaba network/aos - Fix doc for session information (#21718)
* Fix EXAMPLES to make session variable homogeneous across all modules

* Fix parameter name in EXAMPLE, template not design_template
2017-02-21 14:56:12 +00:00
Peter Sprygada
6e9244a9e1 adds more logging output to network_cli and ansible-connection (#21716) 2017-02-21 09:21:41 -05:00
Sebastien Lacoste-Seris
77596951b8 Update vca_vapp.py (#19562)
Check result of vApp creation and return module failure if creation task not present
2017-02-21 09:00:07 -05:00
Ricardo Carrillo Cruz
6622b05326 Fix memory ios facts (#21696)
In order to populate the total and free mem of an IOS device, we run
the 'show memory statistics' command.
The output shows something similar to:

                Head    Total(b)     Used(b)     Free(b)   Lowest(b)  Largest(b)
Processor    BEAE880   335215488    64044364   271171124   268918092   268463852
      I/O    8DAE880    51380224    41880736     9499488     9461552     9352252

We need to just parse the line containing 'Processor' and get the first and third
number for total and free mem, instaed for first and second as the code wrongly
does.
2017-02-21 14:38:35 +01:00
Paulo Matias
46fee994d1 os_subnet: add support for using the default subnetpool (#20191)
Allows to pass use_default_subnetpool instead of a cidr. This is
required when adding an IPv6 subnet if BGP or prefix delegation is
enabled.
2017-02-21 14:27:59 +01:00
Peter Sprygada
2567e8157f fixes bug where handle_prompts failed if list of prompts provided (#21711)
This will now automatically convert the prompts to a list and iterate
over the regexp looking for a prompt match before supplying the answer.
2017-02-21 08:27:33 -05:00
Tim Rupp
96bdb01888 Adds the txcontent manager import for bigip (#21700)
as it is used by some modules and it should be part
of the regular imports
2017-02-21 10:39:54 +00:00
Dag Wieers
b0c6ebf3fc win_shortcut: Clean up parameter handling (#21378)
* win_shortcut: Clean up parameter handling

Minor changes.

* Implemented -WhatIf:$check_mode support
2017-02-21 10:25:45 +00:00
Dag Wieers
b0fdb6ac10 win_timezone: Clean up and check-mode support (#21387)
Changes include:
- Use Get-AnsibleParam with -type support
- Replace $result PSObject with normal hash
- Add check-mode support
2017-02-21 06:01:09 +00:00
Ivan Bojer
21ed43e38a panos module to activate FW licenisng using authentication code (#20154) 2017-02-20 22:23:21 -05:00
Ivan Bojer
dafeb42c2d Panos interface (#20659)
* new module to manage DP interfaces

* - copyright change for the new module

* doc changes as requested
2017-02-20 22:22:22 -05:00
Barry Peddycord III
d1efc8e19e New Networking Module: NCLU (#21101)
* Adding Cumulus NCLU module

* Delete incorrect testing folder

* wrong import location for nclu test

* another wrong import location for nclu test

* unittest library doesn't support 'skip', removing 'real' nclu tests

* Don't need stringio since I'm not doing real tests

* got rid of unnecessary shebang in test_nclu

* version set to 1.0

* Documentation fixes
2017-02-20 22:21:34 -05:00
Peter Sprygada
e4a2c804be partial revert of changes introduced in d5f7a0181b (#21688) 2017-02-20 15:37:14 -05:00
Wayne Witzel III
4632b65086 add Ansible Tower role module (#21592)
* add Ansible Tower role module

* remove owner as choice from role paramenter
2017-02-20 15:18:43 -05:00
Wayne Witzel III
96772719ba add Tower JobTemplate module (#21681)
* add Tower JobTemplate module

* add host_config_key and remove defaults from required parameters
2017-02-20 15:18:04 -05:00
Wayne Witzel III
a59c4d558d add Ansible Tower team module (#21593) 2017-02-20 15:16:32 -05:00
Sloane Hertel
26b10eb160 [modules] Fix bad usages of traceback.format_exc(); doesn't take an error parameter (#21678) 2017-02-20 13:27:39 -05:00
Damien
d9e4248c35 Add doc link to aos_login module (#21684) 2017-02-20 18:15:40 +00:00
Dag Wieers
00668b1544 win_webpicmd: Clean up parameter handling (#21376)
Changes include:
- Use of Get-AnsibleParam and parameter types
- Replace $result PSObject with normal hash
2017-02-20 17:28:25 +00:00
Adrian Likins
d44c80280e Fix vault cli errors on 'encrypt_string_read_stdin' (#21675)
'encrypt_string' only options were being referenced when using
other vault subcommands. That code is moved inside a check
for 'encrypt_string' action now.
2017-02-20 11:38:41 -05:00
Tim Rupp
f37bc92924 Adds required_one_of to f5 utils class (#21650) 2017-02-20 16:01:31 +00:00
Marc Abramowitz
e2e4a69425 hashi_vault: Get token from env var or file
This allows getting the Vault token from the `VAULT_TOKEN` env var or
from the file `$HOME/.vault-token`, as both of these are understood by
the Vault CLI and are a common place to put Vault tokens. This allows
avoiding hard-coding a Vault token into playbooks or having to include
lookups.

`HOME/.vault-token` is nice because a user can authenticate with the CLI
using `vault auth` and then the token will be stored in
`$HOME/.vault-token`. If we read this file, then we allow someone to do
`vault auth` "out of band" to set up Vault access.
2017-02-20 10:10:22 -05:00
Dag Wieers
aae1a00d7e win_say: Clean up and check-mode support
Changes include:
- Clean up parameter handling
- Replace $result PSObject with a hash
- Added check-mode support
2017-02-20 10:02:11 -05:00
René Moser
576ff0728d service: deprecate state=running (#21499)
* service: deprecate state=running

* deprecated with version 2.7
2017-02-20 09:34:52 -05:00
Jordan Borean
a80251ff02 Added win_region module (#19147) 2017-02-20 11:50:27 +00:00
Dag Wieers
1cc9e9f2a1 Clean up windows setup module (#21343)
The following items were implemented:
- Replace PSObject with normal hash
- Replace Set-Attr function with normal hash assignment
- Re-indent code (make sure everything uses 4 spaces)
- Remove trailing semi-colons
2017-02-20 11:49:52 +00:00
Dag Wieers
3c45c93d10 win_reg_stat: Clean up parameter handling (#21380) 2017-02-20 11:49:36 +00:00
Dag Wieers
958cbae7ba win_tempfile: New module implementing tempfile on Windows (#21623)
This module implements the **tempfile** module for Windows.
2017-02-20 11:48:55 +00:00
Aliaksandr Kharkevich
7bc7f13856 Add validate_certs options to gitlab_user and gitlab_group modules (#21415) 2017-02-20 10:43:36 +01:00
Peter Sprygada
bd036c15e0 minor fixes to junos action (#21643)
* adds instrumentation messages
* checks cli context is not in config mode
2017-02-19 18:04:00 -05:00
Peter Sprygada
ce9180b3a1 roll up of vyos action fixes (#21642)
* check cli context is not in config mode
* add display messages for more details
2017-02-19 17:37:16 -05:00
Peter Sprygada
8472ed640b fixes minor bugs in nxos action (#21641)
* checks cli context is correct
* adds display messages
2017-02-19 17:13:14 -05:00
Peter Sprygada
c06b10eedd fix play_context connection_user attribute (#21640)
The connection user needs to be set from the original play_context and
not the copy.  This fixes that problem
2017-02-19 17:11:48 -05:00
David Norman
9b166f6f29 Grammar and spelling on win_iis_webapplication. (#21618) 2017-02-19 18:01:58 +00:00
Peter Sprygada
d5f7a0181b roll up of eos fixes (#21629)
* fixes error where eos would close the cli shell
* fixes network_cli connection plugin to check before calling open_shell()
* fixes json commands being sent over eapi
2017-02-19 08:46:14 -05:00
Peter Sprygada
76c9ad9dfc new module nxos_system (#21627)
* provides declarative config support for nxos system attributes
* adds unit test cases for new module
2017-02-18 18:56:02 -05:00
Peter Sprygada
2f10bdf0c7 roll up of fixes in junos action plugin (#21624)
* calls open_shell() or open_session() depending on connection type
* closes shell after module completion
* adds open_session() to netconf
2017-02-18 17:20:03 -05:00
Brian Coca
c68d81fe4f added check_ps common function 2017-02-18 13:06:09 -05:00
Peter Sprygada
920f9f4815 fixes nxos nxapi implementation (#21615)
* correctly maps play_context to nxapi values
* fixes bug in nxos_nxapi module detecting nxapi feature
* updates nxos shared lib provider values
* fixes missing ssh_keyfile in nxos shared lib
2017-02-18 11:20:26 -05:00
Trond Hindenes
eb6956e1dd win_nssm improvements (#21290)
* win_nssm improvements

* updated version_added
2017-02-18 15:19:12 +00:00
Peter Sprygada
912877c3dd adds no_log to provider arg in iosxr shared lib (#21617) 2017-02-18 09:29:29 -05:00
Peter Sprygada
c875393916 roll up of fixes for vyos base (#21616)
* adds ssh_keyfile to vyos
* fixes play_context mapping to provider
* adds missing network_os to play_context
* executes close_shell() after module completes
2017-02-18 09:29:17 -05:00
Peter Sprygada
e6dfbf63f6 fixes eos action mapping of play_context values (#21614)
* adds mapping for ssh_keyfile
* adds correct mappings for eapi
* fixes missing no_log value for provider arg
2017-02-18 09:29:06 -05:00
Tim Rupp
ff2affd11a Fixes name (#21610)
The named implied the reverse of how I was actually creating the
dictionary, so correct that.
2017-02-18 08:06:21 +00:00
Damien
b607a7b78a New Module : aos_logical_device_map as part of network/aos (#21277)
* Initial version of aos_logical_device_map

* Update doc and fix typo
2017-02-17 20:26:38 -05:00
Damien
615df814f1 New Module : aos_logical_device as part of network/aos (#21226)
* Add new module aos_logical_device

* Add hard stop to documentation

* Removed required false from documentation

* Add comment  before sleep

* Replace IP Pool by Logical Device in the doc
2017-02-17 20:26:21 -05:00
Damien
32e6341f4e New Module : aos_template as part of network/aos (clean) (#21222)
* Add module aos_template

* Add full stop to documentation

* Removed required: false in documentation

* Add comment for sleep
2017-02-17 20:25:57 -05:00
Damien
f9fcffb134 New Module : aos_external_router as part of network/aos (clean) (#21221)
* Add module aos_external_router

* Add hard stop to documentation

* Removed required false from doc

* Add documentation for ASN and loopback
2017-02-17 20:25:42 -05:00
Damien
d930f5f7b1 New Module : aos_login as part of network/aos (clean) (#21220)
* Add module aos_login

* Cleanup documentation and add hard stop

* Add default value in doc for port and remove required: false

* Fix typo in doc for check mode
2017-02-17 20:25:27 -05:00
Damien
c23d699c49 New Module : aos_asn_pool as part of network/aos (clean) (#21224)
* Add module aos_asn_pool

* Add hard stop to documentation

* Remove required: false from doc

* Add pool name in error message when in_use
Change Asn for ASN

* Change the documentation for content
2017-02-17 20:24:43 -05:00
Damien
5084bf474b New Module : aos_blueprint as part of network/aos (#21278)
* Initial release of aos_blueprint

* Cleanup documentation based on review comments

* Change if else to be python 2.4 compatible
2017-02-17 20:24:08 -05:00
Damien
d0e907e661 New Module : aos_device as part of network/aos (#21276)
* Initial version of aos_device

* Clean up documentation

* Move try/except closer to device.approve

* Remove non valid characters

* Change option approve to type bool and fix some typo
2017-02-17 20:23:13 -05:00
Damien
aff83940e2 New Module : aos_blueprint_param as part of network/aos (#21352)
* Add initial version of aos_blueprint_param

* Add a missing hard stop in doc

* Remove type: bool from description
2017-02-17 20:22:55 -05:00
Damien
ebd9eca9e1 Initial version of Rack Type (#21372) 2017-02-17 20:22:41 -05:00
Damien
0200e4fcb9 New Module : aos_blueprint_virtnet as part of network/aos (#21432)
* Initial version of aos_blueprint_virtnet

* Fix indentation in EXAMPLES
2017-02-17 20:22:16 -05:00
Brian Coca
b3b76826e5 Revert "allow device to be list for multidev fs" 2017-02-17 17:31:08 -05:00
Brian Coca
ee17b91455 Revert "add systemd-nspawn connection driver"
This reverts commit 3597ca082b.
2017-02-17 16:36:46 -05:00
Brian Coca
e84713c76c Revert "Remove the --nspawn-extra-args cli option"
This reverts commit b8125ac1a6.
2017-02-17 16:35:47 -05:00
Brian Coca
2d2874fb3c Revert "Add safety checks to nspawn connection plugin"
This reverts commit 60bb677154.

this connection cannot work as is, systemd-nspawn creates instance on each command
2017-02-17 16:35:47 -05:00
Toshio Kuratomi
275be702a8 Switch from using inspect to globals() 2017-02-17 12:57:26 -08:00
Monty Taylor
9bf33e56dd Move availability_zone docs to each OpenStack module (#21540)
* Move availability_zone docs to each OpenStack module

This argument is in the central list for hysterical raisins (mostly me
being a doofus) but is used in almost none of them. Document it
explicitly in each module to stop the confusion.

* Fix two docs formatting bugs
2017-02-17 21:49:03 +01:00
Peter Sprygada
8716a5bc67 maps ios provider ssh_keyfile to play_context (#21597)
This allows the key file to be specified in the playbook for the ios
module provider argument
2017-02-17 18:56:00 +00:00
Thomas Szymanski
60bb677154 Add safety checks to nspawn connection plugin
This patch adds some checks on the path that is accessed as a container,
making sure it looks like one. It implements the connection method and
add adaptations to the modern way of writing connections for Ansible.
It also rewords docs and vars to use the nspawn terminology instead of
chroot.
2017-02-17 12:39:48 -05:00
Thomas Szymanski
b8125ac1a6 Remove the --nspawn-extra-args cli option
Providing extra arguments to pass to systemd-nspawn is still possible
through the `nspawn_connection` of the `ansible.cfg` file.
2017-02-17 12:39:48 -05:00
Lars Kellogg-Stedman
3597ca082b add systemd-nspawn connection driver
This commit adds a connection driver built on top of systemd-nspawn.
This is similar to the existing `chroot` driver, except that nspawn
offers a variety of additional services. For example, it takes care of
automatically mounting `/proc` and `/sys` inside the chroot environment,
which will make a variety of tools work correctly that would otherwise
fail.

You can take advantage of other system-nspawn features to perform more
complicated tasks.  For example, on my x86_64 system I have a Raspberry
Pi disk image mounted on `/rpi`.  I can't use `chroot` with this because
the binaries contained in the image are for the wrong architecture.
However, I can use the systemd-nspawn `--bind` option to automatically
insert the appropriate qemu-arm binary into the container using an
inventory file like this:

    pi ansible_host=/rpi ansible_nspawn_extra_args='--bind /usr/bin/qemu-arm --bind /lib64'

See http://www.freedesktop.org/software/systemd/man/systemd-nspawn.html
for more information about systemd-nspawn itself.
2017-02-17 12:39:48 -05:00
John R Barker
482f882798 Correct example 2017-02-17 17:31:05 +00:00
Toshio Kuratomi
3feb3d6c16 Restore validate_certs being a bool type 2017-02-17 09:17:05 -08:00
Brian Coca
0ddcde2fb2 updated docs to match 2017-02-17 12:04:24 -05:00
Monty Taylor
5d21256d9f Default verify to None for OpenStack modules
This will require a new release of os-client-config.
2017-02-17 11:59:13 -05:00
James Cammarata
1bf8c99974 Update any_errors_fatal field attributes in block/task to match play 2017-02-17 10:25:27 -06:00
Wayne Witzel III
743d48af5c Add Tower Project module (#21479) 2017-02-17 16:19:33 +00:00
Wayne Witzel III
17f0dc3f4d Add Tower Group module (#21480) 2017-02-17 16:19:06 +00:00
Wayne Witzel III
17a2e5ead2 Add Tower Host module (#21482) 2017-02-17 16:18:40 +00:00
Wayne Witzel III
ff3023e82b Add Tower Inventory module (#21483) 2017-02-17 16:18:11 +00:00
Wayne Witzel III
2b6c13f883 Add Tower Label module (#21485) 2017-02-17 16:17:41 +00:00
Ryan Brown
d64d38a1f4 [cloud][docker] Insensitive search for docker port publishing (#21579) 2017-02-17 10:41:26 -05:00
Adrian Likins
7b6c992c46 Vault encrypt string cli (#21024)
* Add a vault 'encrypt_string' command.

The command will encrypt the string on the command
line and print out the yaml block that can be included
in a playbook.

To be prompted for a string to encrypt:
   
   ansible-vault encrypt_string --prompt

To specify a string on the command line:

   ansible-vault encrypt_string "some string to encrypt"

To read a string from stdin to encrypt:

   echo  "the plaintext to encrypt" | ansible-vault encrypt_string

If a --name or --stdin-name is provided, the output will include that name in yaml key value format: 

   $ ansible-vault encrypt_string "42" --name "the_answer"
    the_answer: !vault-encrypted |
          $ANSIBLE_VAULT;1.1;AES256
          <vault cipher text here>

plaintext provided via prompt, cli, and/or stdin can be mixed:

      $ ansible-vault encrypt_string "42" --name "the_answer" --prompt
      Vault password: 
      Variable name (enter for no name): some_variable
      String to encrypt: microfiber
      # The encrypted version of variable ("some_variable", the string #1 from the interactive prompt).
     some_variable: !vault-encrypted |
              $ANSIBLE_VAULT;1.1;AES256
              < vault cipher text here>
      # The encrypted version of variable ("the_answer", the string #2 from the command line args).
      the_answer: !vault-encrypted |
             $ANSIBLE_VAULT;1.1;AES256
             < vault cipher text here>

Encryption successful
* add stdin and prompting to vault 'encrypt_string'
* add a --name to encrypt_string to optional specify a var name
* prompt for a var name to use with --prompt
* add a --stdin-name for the var name for value read from stdin
2017-02-17 10:12:14 -05:00
Zhuo Peng
fe02dbecc0 [cloud] Fix a minor doc error in docker_container module (#21033) 2017-02-17 10:01:15 -05:00
Peter Sprygada
a6cecef6bc clean up of terminal plugins (#21549)
* removes unneeded supports_multiplexing var
* refactors terminal_prompts_re to terminal_stdout_re
* refactors terminal_errors_re to terminal_stderr_re
* updates network_cli unit test cases
2017-02-17 10:00:23 -05:00
Ricardo Carrillo Cruz
c5452eef6f Removes default kwarg in iosxr_argument_spec for timeout (#21569) 2017-02-17 15:59:24 +01:00
Peter Sprygada
4cbbed0b37 fixes issue with prompt detection in network_cli (#21574)
The network_cli plugin would return immediately if an error was
detected.  This patch will force the connection plugin to still try to
detect the current prompt even if an error is found.
2017-02-17 14:13:26 +00:00
Evgeni Golov
d3d1aa2dca synchronize: quote private_key (#21570)
otherwise rsync will fail when trying to access a key with spaces:

fatal: [default]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh 'ssh -i /home/user/Some Folder/.vagrant/machines/default/libvirt/private_key -S none -o StrictHostKeyChecking=no -o Port=22' --out-format='<<CHANGED>>%i %n%L' \"/etc/issue\" \"vagrant@192.168.121.10:/tmp/issue2\"", "failed": true, "msg": "Warning: Identity file /home/user/Some not accessible: No such file or directory.\nssh: Could not resolve hostname folder/.vagrant/machines/default/libvirt/private_key: No address associated with hostname\r\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]\n", "rc": 255}
2017-02-17 14:18:41 +01:00
Peter Sprygada
b0abbb5f8b removes the default kwarg in ios_argument_spec for timeout (#21552)
Uses the configured timeout setting instead of the arg_spec

fixes #21520
2017-02-17 13:12:12 +01:00
Ondra Machacek
a5d34f2ac2 cloud: ovirt: add override_iptables to examples (#21474) 2017-02-17 09:03:24 +00:00
Matt Davis
8527013fbe Complete rewrite of Windows exec wrapper (#21510)
* supports pipelining for faster execution
* supports become (runas), creates interactive subsession under WinRM batch logon
* supports usage of arbitrary module_utils files
* modular exec wrapper payload supports easier extension
* integrates async wrapper behavior for pipelined/become'd async
* module_utils are loaded as true Powershell modules, no more runtime modifications to module code
2017-02-17 00:09:56 -08:00
James Cammarata
7bf56ceee3 Relocate creation of Templar in process_pending_results
Moving it to after the blocks where per-item results are calculated,
as it's not used there and causes quite a performance hit being there.

Fixes #21340
2017-02-17 00:26:09 -06:00
Peter Sprygada
c9f6a2b740 fixes issue with cli shell left open (#21548)
The nxos action plugin will now close the shell connection once the
module has completely run
2017-02-16 22:11:32 -05:00
Peter Sprygada
20c5a1adc1 verifies cli context for iosxr (#21550)
Checks cli context and exits config mode if needed
2017-02-16 22:11:21 -05:00
Peter Sprygada
9d4a3599b8 bug fixes and updates for eos connections (#21534)
* refactors supports_sessions to a property
* exposes supports_sessions as a toplevel function
* adds open_shell() to network_cli
* implements open_shell() in eos action plugin
2017-02-16 20:26:48 -05:00
Peter Sprygada
a01288859d check ios cli context and exits config mode if there (#21544) 2017-02-16 20:26:29 -05:00
Toshio Kuratomi
eeaec56ed5 Use isinstance instead of type() comparisons. isinstance is more robust 2017-02-16 16:34:43 -08:00
Tom Melendez
0d3d8cbcd9 [GCE] Doc fixes for gce_net (#21524)
* Updated examples and added return block.

Doc fix only.  No logic or executable code modified in this commit.
2017-02-16 16:39:00 -05:00
Sumit Kumar
1ba47cdf2e Add NetApp SolidFire volume module (#20732)
* Add NetApp SolidFire volume module

* Make requested changes

* Make requested changes

* Set supports_check_mode to True

* Make requested changes

* Change new_account_id to account_id, 512emulation

* Make requested changes

* Add alias for enable512e

* Move byte_map to utils and add exit message

* Update description for ‘attributes’
2017-02-16 15:21:14 -05:00
Ted Timmons
5d9df86b42 Postgres ssl mode prefer (#21498)
* refactor postgres,
* adds a basic unit test module
* first step towards a common utils module
* set postgresql_db doc argument defaults to what the code actually uses

* unit tests that actually test a missing/found psycopg2, no dependency needed

* add doc fragments, use common args, ansible2ify the imports

* update dict

* add AnsibleModule import

* mv AnsibleModule import to correct file

* restore some database utils we need

* rm some more duplicated pg doc fragments

* change ssl_mode from disable to prefer, add update docs

* use LibraryError pattern for import verification

per comments on #21435. basically LibraryError and touching up its usage in pg_db and the tests.
2017-02-16 11:29:43 -08:00
Ted Timmons
a000594436 fix failing fail_json call in postgresql_schema (#21495)
fix failing fail_json call in postgresql_schema

- Bugfix Pull Request

modules/database/postgresql/postgresql_schema

```
2.3.0
```

Here's an example of the error that was coming out. Massaged some linebreaks and backslashes to make it more readable:

    "module_stderr": "Traceback (most recent call last):
      File "/tmp/ansible_3X05GE/ansible_module_postgresql_schema.py", line 274, in <module>
        main()
      File "/tmp/ansible_3X05GE/ansible_module_postgresql_schema.py", line 265, in main
        module.fail_json(msg="Database query failed: %s" %(text, str(e)))
      NameError: global name 'text' is not defined
    ",

Now it triggers with the correct exception and shows the traceback. This duplication of str(e) and traceback seems to be the best design pattern.

Sample of the new output:

    An exception occurred during task execution. The full traceback is:
    Traceback (most recent call last):
      File "/tmp/ansible_gp4v1Q/ansible_module_postgresql_schema.py", line 254, in main
        changed = schema_create(cursor, schema, owner)
    ...
        return super(DictCursor, self).execute(query, vars)
    ProgrammingError: permission denied for database schemadb

    fatal: [localhost]: FAILED! => {
        "changed": false,
        "failed": true,
    ...
        },
        "msg": "Database query failed: permission denied for database schemadb\n"
2017-02-16 11:26:40 -08:00
Peter Sprygada
02d2b753db refactors junos modules to support persistent socket connections (#21365)
* updates junos_netconf module
* updates junos_command module
* updates junos_config module
* updates _junos_template module
* adds junos_rpc module
* adds junos_user module
2017-02-16 10:53:03 -05:00
Brian Coca
47870c3385 refine password field filtering (#21230)
* refine password field filtering

* dont skip

* removed bad leftover vestige of previous condition
2017-02-16 10:52:27 -05:00
Brian Coca
cc0bb54d2c the return of reset_connection
allows user to force persistent connection to close, needed for when
you want to benefit from changes applied to the current play but persistent connections
prevent them from being realized.
2017-02-16 10:49:57 -05:00
Tomas Tomecek
30026cfb84 [cloud] module docker_image: print output on failure (#20757)
Fixes https://github.com/ansible/ansible-modules-core/issues/5161

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2017-02-16 09:47:18 -05:00
Will Thames
f42ffe6de3 [cloud] Ensure that s3_bucket module always enables/disables versioning if it is specified (#21320)
If versioning is not enabled, then `get_bucket_versioning`
can return an empty dict.

If that happens, the code to enable versioning should still
run!

The logic for suspending versioning was also incorrect, so
have updated that too.

Fixes #20491
2017-02-16 09:45:05 -05:00
Sloane Hertel
a077aeb693 [cloud][aws] Refactor s3 module, and add 'ignore_nonexistent_bucket' option (#20501)
Introduces `ignore_nonexistent_bucket` option that does not require ListBuckets permission, so less permissioned IAM roles can still be used with this module. 

Fixes #20501
2017-02-16 09:39:11 -05:00
Peter Sprygada
34e6cc788f check cli context to be sure out of config mode in ios (#21493)
This change will now check the cli context after a module runs and if
the cli is still in config mode it will exit config mode.  Also fixes a
minor issue with converting list of commands to a dict

fixes #21481
2017-02-16 12:54:33 +00:00
Dag Wieers
edf2b00614 win_regmerge: Clean up parameter handling (#21388)
Changes include:
- Use Get-AnsibleParam with -type support
- Replace $result PSObject with normal hash
2017-02-16 12:41:59 +00:00
Dave Kasberg
dbb452100a New module: cnos_vlan and various utility files (#21107)
* First set of CNOS network modules

Two modules: cnos_vlan and cnos_command.  First 2 of 17 CNOS modules

* Revert "First set of CNOS network modules"

This reverts commit 63da68b2a857e622b449f514050eed25fbcf0a35.

* cnos_vlan module

First of 17 CNOS modules

* Modify playbook for cnos_vlan module testing

* fix issue found by shippable in cnos.py

* cnos_backup module

* Fix Python3.5 compilation error

* remove cnos_backup module from this PR

* add aliases file so that testing of the cnos_vlan module will be skipped.

* Use empty aliases file

* utility scripts under module_utils changed to BSD license.

* clean up PEP8 issues, add cnos_vlan tests

* remove blank lines from yml files

* remove more blank lines

* remove even more blank lines

* Revert "remove even more blank lines"

This reverts commit bb3998661ce387260340bca39d5f146f5ec54f44.

* re-submit last commit

* fix blank lines in this file under parsing

* fix yamllint errors in doc section of cnos_vlan

* Fix errors reported by Sanity check using validate-modules

* change test playbook to include tasks for all modules

* fix additional pep8 errors

* more fixes, plus fix for python3

* fix for empty options section, removed unnecessary documentation

* fix up documentation section

* Correct options capitalization

* fix example section, add options

* Fix example section of the documentation
2017-02-16 08:11:39 +00:00
Peter Sprygada
d77a6bda97 remove unneeded module eapi 2017-02-15 20:47:43 -05:00
Peter Sprygada
d3b57a2f9c more cleanup from net_command module that is abandoned for 2.3 (#21497) 2017-02-15 20:38:57 -05:00
James
87646595e3 Remove the end of the task_data.path which causes #21461 2017-02-15 17:35:16 -08:00
johnnysheppard-isode
54de41309f win_lineinfile backrefs bug fix and updated examples. (#20926)
* Bug Fix for win_lineinfile and updated examples.

- changed $backrefs to a bool so it works with true/false/yes/no. This also fixes idempotency.
- Updated Docs with an example of using backrefs.

* Made suggested updates and converted two more parameters to "bool"

* Updated the Exception message

- Now contains the Windows Exception message as well as a custom message to help point in the right direction of a failed write.

* Updated Exception Handling

- Added Exception checks for Creating and removing the temporary files.
- Changed the ErrorAction on the copy tmpfile and remove tmp file to "Stop" to
  cause the exception handler to catch all errors so we can fail gracefully
  every time.
2017-02-15 20:09:30 -05:00
Jasper Lievisse Adriaanse
52960ff7d0 Fix service_mgr fact for Solaris; svcs is used to list services.
Instead use 'smf' to reflect the name of framework, as is done elsewhere
(e.g. 'systemd' instead of 'systemctl').
2017-02-15 20:07:16 -05:00
Sloane Hertel
f775996209 add 'version_added' field for environment_variables option in lambda.py (#21500)
* Add 'version_added' field for environment_variables option (version_added: "2.3")
2017-02-15 18:52:48 -05:00
Abdoul Bah
c22fbdc831 resolve #21056 - Add support for full cloning a Qemu VM. Fix some issues. Update doc (#21225)
* resolve #21056 - Add support for full cloning. Fix some issues. Update doc

* Fix condition and update doc. Fixes #28585

* Using built-in helper for argspec, revert ansible metadata, add more control and remove type in documentation

* PEP8 style compliance
2017-02-15 22:51:46 +00:00
Tim Rupp
7869b543fa Changes attribute to be public (#21490)
eom
2017-02-15 22:48:31 +00:00
Benjamin JOLIVOT
9baf95bcc4 Add status_code & failed:false when status==200 (#21457)
* Add status_code & failed:false when status==200

* remove failed=false, it's broking tests
2017-02-15 14:30:06 -08:00
James Cammarata
eec88b63c2 Fix bug introduced in 0df3767 regarding undefined entries in HostVars
Fixes #21084
2017-02-15 16:22:31 -06:00
Matt Martz
78a000502e YAML fixes for examples in additional modules 2017-02-15 13:01:43 -08:00
Matt Martz
7c00346714 Validate EXAMPLES as YAML 2017-02-15 13:01:43 -08:00
Michael Scherer
6fae1d2bbf Make password lookup treat /dev/null as a special case
I have from time to time a need of random password without
wanting to write them down (one example is mailman list creation,
that requires a password to be given to be sent to the list owner).

But using /dev/null do not return null, but the empty string, which
doesn't generate a password at all and so do not achieve my use case.
2017-02-15 12:15:09 -08:00
Will Thames
103ede26df Ensure ssh hostkey checks respect server port (#20840)
* Add tests for `get_fqdn_and_port` method.

Currently tests verify original behavior - returning default `ssh-keyscan` port
Add test around `add_host_key` to verify underlying command arguments
Add some new expectations for `get_fqdn_and_port`
Test that non-standard port is passed to `ssh-keyscan` command

* Ensure ssh hostkey checks respect server port

ssh-keyscan will default to getting the host key for port 22.
If the ssh service is running on a different port, ssh-keyscan
will need to know this.

Tidy up minor flake8 issues

* Update known_hosts tests for port being None

Ensure that git urls don't try and set port when a path
is specified

Update known_hosts tests to meet flake8

* Fix stdin swap context for test_known_hosts

Move test_known_hosts from under basic, as it is its own library.
Remove module_utils.known_hosts from pep8 legacy files list
2017-02-15 11:47:57 -08:00
Matt Clay
09f4242ce4 Fix junit callback handling of surrogate escapes. 2017-02-15 10:51:55 -08:00
Toshio Kuratomi
99fd2328af Fix hash filter for non-ascii strings and Python3
hashlib hashes operate on byte strings.  When given a text string on
Python3, hashlib backtraces.  When given a text string on Python2,
hashlib will backtrace if the string contains non-ascii characters.
Encode the text string to utf-8 prior to hashing to avoid this problem.

Fixes #21452
2017-02-15 10:50:10 -08:00
Wilfrido Vidana
e89259dbd0 Fixes #19835: enable role attribute change when not changing password (#19834)
Fixes #19835
2017-02-15 13:47:15 -05:00
Adrian Likins
106439e470 Handle sysctl.conf files that use ';' for comments (#20576)
'#' and ';' are both valid comment chars for sysctl.conf files
according to the 'man sysctl.conf':

  "Lines which begin with a # or ; are considered comments and ignored."

Fixes #20569
2017-02-15 13:37:09 -05:00
Daniel O'Brien
320c791cfb Adding more functionality for Linode cloud module 2017-02-15 10:26:40 -08:00
Peter Sprygada
48b02336ab code clean of old code from network modules updates (#21469)
* removes unused code
* removes module_utils/local.py
* removes plugins/action/network.py
* removes action_handler from connection plugins
* removes code to use action_handler in task_executor
* updates action plugins to subclass from normal
2017-02-15 12:46:30 -05:00
Peter Sprygada
2d14cdc5ac fixes broken run_commands() method (#21478) 2017-02-15 12:12:59 -05:00