Commit Graph

33 Commits (cf6a92d268093ae390d31e893712b0e3263c8a37)

Author SHA1 Message Date
Matt Martz 445ff39f94
Become plugins (#50991)
* [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
6 years ago
Richard Diphoorn ad549e375a Changed 'Control Machine' to 'Control Node' (#51696)
* Changed 'Control Machine' to 'Control Node' in the documentation. Changing the term 'Control Machine' to 'Control Node', to be in line with the basic concepts here: https://docs.ansible.com/ansible/latest/network/getting_started/basic_concepts.html

Also for both entities; Control/Managed using the same common denominator 'Node' brings consistency.

* Updated reference links to new term.
6 years ago
Simon Legner 33b9c880a4 Consistent typesetting of "GitHub" (#50929) 6 years ago
Alicia Cozine 4d6807a6b0 uses correct highlighting (#50457) 6 years ago
Humberto Nanni 128760cc47 Update intro_installation.rst (#49756)
directions to install ansible on CLR Linux
6 years ago
mbk87 95d810ab94 apt over apt-get (#47663)
* apt over apt-get

* added note on apt-get for older versions
6 years ago
Keith Maxwell 7db2861961 Remove unnecessary --recursive option to git clone (#48379)
From installing / Running from source.
Since the repomerge, Ansible doesn't use submodules. Also, between 2.12.0 and 2.13.0 git dropped '--recursive' in favor of '--recurse-submodules'.
6 years ago
majekw 383da46c32 Document installation procedure on Slackware (#47657)
Add section with installation procedure on Slackware Linux using sbopkg and SlackBuilds.org build scripts repository.
6 years ago
InputValidation 7760b04020 Updated Red Hat Repo (#48173)
Updated Red Hat Repo to current version number
6 years ago
Matt Martz 45ff6df1af Remove Deprecated configs 2.8 (#46825)
* Removed deprecated ANSIBLE_HOSTS

* Bump sudo/su configs to match deprecation version for cli and playbook args

* Bump include configs to match deprecation version for 'include'
6 years ago
Luke Short 9cf407f683 Gentoo installation no longer requires a workaround. (#47151)
The default Python version has been 3.6
since June 2018 and was 3.5 before then.
Ansible supports Python 3.5 and above.
6 years ago
Kamil Wilczek 78e9f452a5 Simplify PPA installation for Ubuntu (#45690)
Adds the `--update` flag to automatically update the cache and the `--yes` flag to disable the Ansible repo description and skips confirmation dialog. +label: docsite_pr
6 years ago
Brian Coca e9c2695ce7 updated fbsd install instructions (#45309) 6 years ago
Sam Doran d257095976 Change Mac OSX to macOS in installation docs (#44971)
* Change Mac OSX to macOS in docs

* Lowercase via
6 years ago
Andreas Olsson 00e5123e4c Update documentation based on 301 permanent redirects (#43675) 6 years ago
Toshio Kuratomi da26ba3760 Documentatin fixes 6 years ago
Toshio Kuratomi c4951cce0b Exorcise Python-2.6 6 years ago
Andreas Olsson 1a11cecaef Prefer https:// links in the docs site
All the changed urls are availible by way of https://. Most of them
already redirect.
6 years ago
Brian Coca b6f2aad600 ignore ansible.cfg in world writable cwd (#42070)
* ignore ansible.cfg in world writable cwd
 * also added 'warnings' to config
 * updated man page template
6 years ago
Troy Murray 15ce7c5bab change OS X to macOS (#41294)
* change OS X to macOS

<!--- Your description here -->

+label: docsite_pr

* Update all Mac OS X references to be macOS

* Drop extra Mac
6 years ago
Abhijeet Kasurde 01cdc22ac6
Add documentation around package dependencies (#41437)
Documented procedure to handle package dependencies required by
packages which are Ansible dependencies.

Fixes: #30732
Fixes: #16571

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
6 years ago
Abhijeet Kasurde e8227e8395
Add note about updating pip (#41124)
Fixes: #39120

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
6 years ago
Pilou 3f5f5faec6 doc: config intro, add link to searched locations (#39614) 6 years ago
Alicia Cozine 4b52a54e18 Reduce warnings (#39254)
* removes FAQ links; no entries exist for linked config settings

* fixes various anchors and links

* addresses abadger comments, thanks

* marks orphan pages, avoids TOC errors

* adds links for remote_tmp setting to FAQ
6 years ago
Matt Clay c262dbfd30 Use https for links to ansible.com domains. 6 years ago
Matt Clay 7e96421132
Handle warnings in docs-build sanity test. (#39043) 7 years ago
Toshio Kuratomi a08459a814
Update info on python support (#38855)
* Update the documentation to list Python 3 as official
* Add some reference targets for inventory variables so we can link to docs
* Add a platform FAQ section
  Populate it with

  * virtualenv info (previously on the python3 support page)
  * BSD (Link to the working with BSD page)
  * Solaris (Document how to work around the non-POSIX shell on some
    Solaris hosts)

  Fixes #21594

* Fix some refs in the release_and_maintenance document

* Fix unindent error in module template

Fix for the module/plugin template unintentionally unindented inside of
a raw block, leading to errors like:

ERROR: docs/docsite/rst/modules/redshift_facts_module.rst:289:0: Explicit markup ends without a blank line; unexpected unindent.

* Make wording for Solaris troubleshooting better.
7 years ago
scottb c97e508806
[WIP] disambiguating autogenerated module docs attempted fix of #38439. (#38890)
Disambiguates autogenerated module docs - fixes #38439.
7 years ago
Abhijeet Kasurde 8bc7af2e34 Minor typo in installation guide (#38452)
Change subsription-manger to subscription-manager

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
Elijah Lynn 95d40bcd0a Update fish setup to use `source` instead of `.` (#33207)
"The use of . is deprecated in favour of source, and . will be removed in a future version of fish."

source: https://fishshell.com/docs/current/commands.html#source
7 years ago
Sam Doran 34dca85417 Update installation docs for RHEL based distributions. (#38056)
Upstream rpms are no longer in Extras but EPEL as well as releases.ansible.com.
Add instructions for adding Ansible Engine repo to RHEL.
7 years ago
scottb 381359a8f8
Doc build warning/broken link clean-a-palooza (#37382)
* Doc build warning/broken link clean-a-palooza, WIP commit 1.

* Fixed broken anchor

* Fixing additional broken links; converting from doc to ref.

* Fix anchor
7 years ago
scottb 373b1dcf59
Core Docs Refactor and Redesign (#36067)
* Docs refactor as outlined in https://github.com/ansible/proposals/issues/79. Moves content into 'guides'; refactors TOC; fixes CSS; design tweaks to layout and CSS; fixes generated plugin, CLI and module docs to fix links accodingly; more.

* Adding extra blank line for shippable
7 years ago