summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Fix wrong ssh_connection group (#75888)Rob Quist2021-10-271-1/+1
|
* [backport][2.9][PR #70446] Refactor Python API examples and docs (#70851)Sviatoslav Sydorenko2020-08-061-28/+57
| | | | | | | | | | | | | | | | | | | * Add boilerplate snippet into `examples/` It is a partial backport of #70224 (partially cherry picked from commit 4816bb4f43ee22f20fa7d75a79db659cc1cdeaf3) * Refactor Python API examples and docs PR #70446: it's a follow-up for #70445. It includes a merge of `examples/scripts/uptime.py` and a similar code snippet from `docs/docsite/rst/dev_guide/developing_api.rst`. This patch also changes the docs RST file to include contents of the example file instead of holding a copy of a similar code. (cherry picked from commit 20bb91509279ff91bf8410972827a95e1af55075)
* Fix the internal Python API usage examples (#70842)Sviatoslav Sydorenko2020-08-061-9/+17
| | | | | | | | | | | | | | Previous version initialized the `TaskQueueManager` after calling `Play.load()` while advertising a way to inject a custom library location path. This caused the tasks loader not to find any custom modules because it was triggered before the path was actually added to the module loader. This patch changes the order of the operations to ensure that the customized `context.CLIARGS` actually influences things. Resolves https://github.com/ansible/ansible/issues/69758. (cherry picked from commit 8d97c8c222d134cb1108310c5b22eb65ead2d2d3)
* add vfat to selinux special_context_filesystems (#59823)James Cassell2019-08-121-1/+1
| | | | | | vfat is the format of the /boot/efi partition on UEFI hosts and does not support SELinux labels add an environment variable for this config option
* many pslint fixes (#55862)Shachaf922019-07-092-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Handles: PSAvoidTrailingWhitespace PSAvoidGlobalVars PSAvoidAssignmentToAutomaticVariable PSAvoidUsingCmdletAliases PSAvoidUsingWriteHost PSUseDeclaredVarsMoreThanAssignments PSUsePSCredentialType PSAvoidUsingPositionalParameters PSAvoidUsingEmptyCatchBlock PSAvoidUsingWMICmdlet Replaced Write-Host with Write-Output Added smart reboot check for win_domain feature installation Modify the Creation of the pagefileto fit to CIM Changelog fragment addition Ignore.txt without fixes * Changes after community reviews * Change Out-Null to '> $null' * Fixes after jborean93 comments * Test * Revert "Test" This reverts commit 35c5c0648fa9d2868a18094d84954e53ffa28880. * Removed all > $null since they broke the module since the output got dumped * run test again * Revert "run test again" This reverts commit 80eaf07143f9d8cb0116cbbc68a6a69c0ace840c. * Changes after community review * ignore PSUseDeclaredVarsMoreThanAssignments that are on a diffrent PR * CI failed on extra line in ignore.txt * Review changes * PSlint errors * Trail space * send to null breaks the tests for Set-Workgroup * Lint stuff * win_domain_user issue of indent. * Update win_domain_user.ps1 * Update win_domain_membership.ps1 * Fix redirect to null * lint space issue * removed return from set-workgroup * removed send to null
* Clearer examples of hosts.yml inventory (#57999)Brian Coca2019-06-181-24/+35
| | | * Clearer examples of hosts.yml inventory
* Change the retry_files_enabled to False and modify the comments to reflect ↵Chuck Douglas2019-02-281-2/+2
| | | | | | | | | | | | | | | | that this has been disabled (#52581) * Change the retry_files_enabled to False and modify the comments to reflect that this has been disabled. * Change the default action of retry_files_enabled to False * Update porting guide to reflect change in default state of retry_files_enabled variable * Change log documenting a change in default behaviour of retry_files_enabled * Revert config change to comment out the retry_files_enabled line to let the user decided what is best. Comment above still states how to change.
* examples: fix Ansible API example (#51863)Abhijeet Kasurde2019-02-121-13/+9
| | | Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Become plugins (#50991)Matt Martz2019-02-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [WIP] become plugins Move from hardcoded method to plugins for ease of use, expansion and overrides - load into connection as it is going to be the main consumer - play_context will also use to keep backwards compat API - ensure shell is used to construct commands when needed - migrate settings remove from base config in favor of plugin specific configs - cleanup ansible-doc - add become plugin docs - remove deprecated sudo/su code and keywords - adjust become options for cli - set plugin options from context - ensure config defs are avaialbe before instance - refactored getting the shell plugin, fixed tests - changed into regex as they were string matching, which does not work with random string generation - explicitly set flags for play context tests - moved plugin loading up front - now loads for basedir also - allow pyc/o for non m modules - fixes to tests and some plugins - migrate to play objects fro play_context - simiplify gathering - added utf8 headers - moved option setting - add fail msg to dzdo - use tuple for multiple options on fail/missing - fix relative plugin paths - shift from play context to play - all tasks already inherit this from play directly - remove obsolete 'set play' - correct environment handling - add wrap_exe option to pfexec - fix runas to noop - fixed setting play context - added password configs - removed required false - remove from doc building till they are ready future development: - deal with 'enable' and 'runas' which are not 'command wrappers' but 'state flags' and currently hardcoded in diff subsystems * cleanup remove callers to removed func removed --sudo cli doc refs remove runas become_exe ensure keyerorr on plugin also fix backwards compat, missing method is attributeerror, not ansible error get remote_user consistently ignore missing system_tmpdirs on plugin load correct config precedence add deprecation fix networking imports backwards compat for plugins using BECOME_METHODS * Port become_plugins to context.CLIARGS This is a work in progress: * Stop passing options around everywhere as we can use context.CLIARGS instead * Refactor make_become_commands as asked for by alikins * Typo in comment fix * Stop loading values from the cli in more than one place Both play and play_context were saving default values from the cli arguments directly. This changes things so that the default values are loaded into the play and then play_context takes them from there. * Rename BECOME_PLUGIN_PATH to DEFAULT_BECOME_PLUGIN_PATH As alikins said, all other plugin paths are named DEFAULT_plugintype_PLUGIN_PATH. If we're going to rename these, that should be done all at one time rather than piecemeal. * One to throw away This is a set of hacks to get setting FieldAttribute defaults to command line args to work. It's not fully done yet. After talking it over with sivel and jimi-c this should be done by fixing FieldAttributeBase and _get_parent_attribute() calls to do the right thing when there is a non-None default. What we want to be able to do ideally is something like this: class Base(FieldAttributeBase): _check_mode = FieldAttribute([..] default=lambda: context.CLIARGS['check']) class Play(Base): # lambda so that we have a chance to parse the command line args # before we get here. In the future we might be able to restructure # this so that the cli parsing code runs before these classes are # defined. class Task(Base): pass And still have a playbook like this function: --- - hosts: tasks: - command: whoami check_mode: True (The check_mode test that is added as a separate commit in this PR will let you test variations on this case). There's a few separate reasons that the code doesn't let us do this or a non-ugly workaround for this as written right now. The fix that jimi-c, sivel, and I talked about may let us do this or it may still require a workaround (but less ugly) (having one class that has the FieldAttributes with default values and one class that inherits from that but just overrides the FieldAttributes which now have defaults) * Revert "One to throw away" This reverts commit 23aa883cbed11429ef1be2a2d0ed18f83a3b8064. * Set FieldAttr defaults directly from CLIARGS * Remove dead code * Move timeout directly to PlayContext, it's never needed on Play * just for backwards compat, add a static version of BECOME_METHODS to constants * Make the become attr on the connection public, since it's used outside of the connection * Logic fix * Nuke connection testing if it supports specific become methods * Remove unused vars * Address rebase issues * Fix path encoding issue * Remove unused import * Various cleanups * Restore network_cli check in _low_level_execute_command * type improvements for cliargs_deferred_get and swap shallowcopy to default to False * minor cleanups * Allow the su plugin to work, since it doesn't define a prompt the same way * Fix up ksu become plugin * Only set prompt if build_become_command was called * Add helper to assist connection plugins in knowing they need to wait for a prompt * Fix tests and code expectations * Doc updates * Various additional minor cleanups * Make doas functional * Don't change connection signature, load become plugin from TaskExecutor * Remove unused imports * Add comment about setting the become plugin on the playcontext * Fix up tests for recent changes * Support 'Password:' natively for the doas plugin * Make default prompts raw * wording cleanups. ci_complete * Remove unrelated changes * Address spelling mistake * Restore removed test, and udpate to use new functionality * Add changelog fragment * Don't hard fail in set_attributes_from_cli on missing CLI keys * Remove unrelated change to loader * Remove internal deprecated FieldAttributes now * Emit deprecation warnings now
* Increase persistent command_timeout default value (#51056)Ganesh Nalawade2019-01-211-9/+2
| | | | | | | | | | * Increase persistent command_timeout default value * Increase command_timeout default value from 10 to 30 sec to reduce frequent timeout issue for network connection types (netconf/network_cli/httpapi/napalm) * Fix review comments
* Fix usetty keyword in example ansible.cfg (#51084)jctanner2019-01-181-1/+1
|
* inventory plugin order: update docPierre-Louis Bonicoli2018-12-121-1/+1
| | | | | | | | | add doc for #44428: - add changelog fragment - update porting guide also: - update auto inventory plugin doc - mention toml plugin in examples
* Inventory plugins move auto before ini (#44428)Pilou2018-12-111-1/+1
| | | | | | | | | | | | | * inventory plugins: try auto before ini auto plugin should run before ini to avoid ini being able to parse some plugin configuration YAML files successfully. * Update comment comment was added by 2ffe3c42bb15263ad67dd36842712d9d3ec99070 but related code was later removed by 506e6a0b2d49a147e1c0c0b301c71163ea785d71.
* Add comment about group merge in yaml inventory example (#24986)Monty Taylor2018-11-291-2/+9
| | | | * Add comment about group merge in yaml inventory example, w/bcoca feedback
* Misc Typo (#48918)Abhijeet Kasurde2018-11-201-1/+1
| | | | | Changed hostames to hostnames Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Add 'auto' to documented default enabled inventory plugins (#46621)Sloane Hertel2018-10-081-1/+1
| | | | | | * Correct default inventory plugins enabled in docs and example/ansible.cfg * Fix headers
* explicitly set LocalAccountTokenFilterPolicy on WinRM configure script (#45947)Jordan Borean2018-09-251-0/+15
|
* Add undocumented configuration parameter and explain in porting guide (#36059)skylerbunny2018-09-171-0/+9
| | | * Add undocumented configuration parameter and explain in porting guide
* Surround top-level function and class definitions with two blank lines.Joren Vrancken2018-07-311-0/+1
|
* Fix some broken links (#42079)John R Barker2018-06-291-2/+1
| | | | | | | * Fix some broken links * We now only serve via https * redirects don't work with anchors, so update those links (devel/dev_guide)
* update ansible.cfg example (#41832)李宏杰2018-06-221-0/+7
|
* draft schema for inventory scripts (#39454)Brian Coca2018-05-241-0/+53
| | | | | | | | | | | | * draft schema for inventory scripts used by the script inventory plugin * fixes and details for vars * proper escape * restrict additional
* Add ssh_connection retries to ansible.cfg example (#38393)Matt Ralph2018-05-241-0/+5
| | | | I add the `retries` option under [ssh_connection] as it was missing, and some brief comments on the backoff logic.
* Use https for links to ansible.com domains.Matt Clay2018-04-231-1/+1
|
* Generate SHA256 signed certificates for WinRM (#36668)David Norman2018-04-201-1/+33
| | | | | | | | | | | | | | | | | | | | * Generate SHA256 signed certificates Vulnerability scanners are increasingly reporting SHA-1 signed certificates as a vulnerability on servers. Before this change, -ForceNewSSLCert generates a signature algorithm that openssl shows as sha1WthRSAEncryption for WinRM port 5986. After, this forces certificates to be signed with SHA256, which openssl shows sha256WithRSAEncryption. Some example SHA-1 deprecations include: - https://docs.microsoft.com/en-us/security-updates/SecurityAdvisories/2017/4010323 - https://blog.mozilla.org/security/2014/09/23/phasing-out-certificates-with-sha-1-based-signature-algorithms/ Also note that RDP 3389 on Windows 2016 also defaults to a SHA256 certificate. The specifics were merged from a script mod I found at https://gallery.technet.microsoft.com/scriptcenter/PowerShell-script-to-7a0321b7 intended for Exchange. It also includes a mod to add an alternate DNS listing so the cert contains CN=HOSTNAME plus now also an alternative of the FQDN. I tested this change on Windows 2008R2, 2012R2, and 2016 Datacenter. * Keep WinRM cert key length at 4096. * Remove WinRM cert exportpolicy setting.
* Implement plugin filteringToshio Kuratomi2018-01-222-0/+7
|
* Update example uptime script to provide correct type for explicit individual ↵John Bond2018-01-161-2/+7
| | | | hosts (#34740)
* Python 2.6 `str.format()` compatibility fixes.Matt Clay2018-01-101-3/+3
|
* Added possibility to disable basic auth (#33224)Erwan Quélin2018-01-021-10/+32
|
* avoid use of Write-Host in config scriptMatt Davis2017-12-201-3/+3
|
* add GlobalHttpFirewallAccess arg (#34124)Matt Davis2017-12-201-1/+60
|
* ANSIBLE_SSH_USETTY configuration option (#33148)jctanner2017-11-221-0/+4
| | | | | | | | | * Allow the user to circumvent adding -tt on ssh commands to help aid in debugging ssh related problems. * Move config to the plugin * Set version_added * Change yaml section to "connection" * Fix ssh unit tests
* Set example ansible.cfg *includes_static options to default valueJason Travis2017-11-021-2/+2
|
* Explain -EnableCredSSP in headerDag Wieers2017-11-021-0/+2
| | | The new Windows documentation references the top of this file for a list and explanation of options, however `-EnableCredSSP` was missing from this list.
* Fixes default format of network_group_modules to ini list. Removing trailing ↵James Mighion2017-11-011-10/+10
| | | | whitespaces from comments for style consistency. Fixes #26154 (#32460)
* minor text fixesSudheer Satyanarayana2017-10-231-5/+5
|
* removed example for restricted facts namespaceBrian Coca2017-10-041-4/+0
| | | | | | (cherry picked from commit e1fab373163ea3213fb51d3460ca5baa7ff29381) fixes #31330
* Update uptime.py example script with changes to the API. Fixes #31229Matt Martz2017-10-041-6/+6
|
* dont override previous ini entries with defaultsBrian Coca2017-09-201-1/+1
| | | | | corrected setting example, quotes mess up the regex fixes #30633
* fixed typoBrian Coca2017-08-291-1/+1
|
* add toggle to controle inventory parse as error (#28729)Brian Coca2017-08-281-3/+13
| | | | | | | | | | | | * add toggle to controle inventory parse as error also rearranged new inventory options into it's own ini section * updated with inventory features also minor fixes/consolidation on deprecated/removed modules * tweaked settings
* Moar constructive (#28254)Brian Coca2017-08-211-1/+1
| | | | | | | | | | | | * made composite vars and groups generic now you can do both in every plugin that chooses to suport it renamed constructed_groups as it now also constructs vars ... to constructed moved most of constructed_groups logic into base class to easily share * documented inventory_hostname * typo fix
* Set startup type to automatic before attempting to start the service. ↵Simon Liddicott2017-08-071-3/+3
| | | | Otherwise it will fail if the service is disabled. (#27751)
* Persistent connection timer changes (#27272)Ganesh Nalawade2017-08-011-12/+13
| | | | | | | | | | | * Add command_timeout timer that defines the amount of time to wait for a command or RPC call before timing out. * Remove connect_retries and connect_interval configuration varaible and replace it with connect_retry_timeout to control the timeout value of connection to local scoket. * Make required changes to netowrk action plugins and relevant network files in module_utils. * Required documentation changes.
* Fix one name in module error due to rewritten VariableManagerToshio Kuratomi2017-07-271-1/+1
|
* add any_errors_fatal global configBrian Coca2017-07-031-0/+3
|
* Fix spelling mistakes (comments only) (#25564)Abhijeet Kasurde2017-06-122-2/+2
| | | | | | | | Original Author : klemens <ka7@github.com> Taking over previous PR as per https://github.com/ansible/ansible/pull/23644#issuecomment-307334525 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* corrected default inventory plugin orderBrian Coca2017-06-021-1/+1
| | | | | | | default inventory plugin order now follows the hardcoded one in previous versions yaml plugin shoudl run before ini to avoid ini being able to parse some yaml files succesfully. fixes #25321
* Transition inventory into plugins (#23001)Brian Coca2017-05-231-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * draft new inventory plugin arch, yaml sample - split classes, moved out of init - extra debug statements - allow mulitple invenotry files - dont add hosts more than once - simplified host vars - since now we can have multiple, inventory_dir/file needs to be per host - ported yaml/script/ini/virtualbox plugins, dir is 'built in manager' - centralized localhost handling - added plugin docs - leaner meaner inventory (split to data + manager) - moved noop vars plugin - added 'postprocessing' inventory plugins - fixed ini plugin, better info on plugin run group declarations can appear in any position relative to children entry that contains them - grouphost_vars loading as inventory plugin (postprocessing) - playbook_dir allways full path - use bytes for file operations - better handling of empty/null sources - added test target that skips networking modules - now var manager loads play group/host_vars independant from inventory - centralized play setup repeat code - updated changelog with inv features - asperioribus verbis spatium album - fixed dataloader to new sig - made yaml plugin more resistant to bad data - nicer error msgs - fixed undeclared group detection - fixed 'ungrouping' - docs updated s/INI/file/ as its not only format - made behaviour of var merge a toggle - made 'source over group' path follow existing rule for var precedence - updated add_host/group from strategy - made host_list a plugin and added it to defaults - added advanced_host_list as example variation - refactored 'display' to be availbe by default in class inheritance - optimized implicit handling as per @pilou's feedback - removed unused code and tests - added inventory cache and vbox plugin now uses it - added _compose method for variable expressions in plugins - vbox plugin now uses 'compose' - require yaml extension for yaml - fix for plugin loader to always add original_path, even when not using all() - fix py3 issues - added --inventory as clearer option - return name when stringifying host objects - ajdust checks to code moving * reworked vars and vars precedence - vars plugins now load group/host_vars dirs - precedence for host vars is now configurable - vars_plugins been reworked - removed unused vars cache - removed _gathered_facts as we are not keeping info in host anymore - cleaned up tests - fixed ansible-pull to work with new inventory - removed version added notation to please rst check - inventory in config relative to config - ensures full paths on passed inventories * implicit localhost connection local
* examples/: PEP8 compliancy (#24682)Dag Wieers2017-05-181-17/+20
| | | - Make PEP8 compliant