跳转到主要内容

章节Ansible 用户指南

Dev Guide

102 页更新于 3 天前

开始阅读

本章内容102

  1. 01 Developer Guide [!NOTE] Making Open Source More Inclusive Red Hat is committed to replacing problematic language in our cod... 3 天前
  2. 02 Ansible markup Ansible markup allows you to format and structure documentation for Ansible modules, plugins, and roles. It... 3 天前
  3. 03 `ansible-core` project branches and tags devel branch All new development on the next version of ansible-core occurs exclusively in the devel bran... 3 天前
  4. 04 Developer Guide [!NOTE] Making Open Source More Inclusive Red Hat is committed to replacing problematic language in our cod... 3 天前
  5. 05 Debugging modules Detailed debugging steps Ansible modules are put together as a zip file consisting of the module file and t... 3 天前
  6. 06 Python API Topics Attention The Ansible API is intended for internal Ansible use. Ansible may make changes to this API... 3 天前
  7. 07 Developing collections Collections are a distribution format for Ansible content. You can package and distribute playbooks, roles,... 3 天前
  8. 08 Generating changelogs and porting guide entries in a collection You can create and share changelog and porting guide entries for your collection. If your collection is par... 3 天前
  9. 09 Contributing to collections If you want to add functionality to an existing collection, modify a collection you are using to fix a bug,... 3 天前
  10. 10 Creating collections To create a collection: Create a new collection<creating_new_collections>, optionally using a custom coll... 3 天前
  11. 11 Distributing collections A collection is a distribution format for Ansible content. A typical collection contains modules and other ... 3 天前
  12. 12 Documenting collections Documenting modules and plugins Documenting modules is thoroughly documented in module_documenting. Plugin... 3 天前
  13. 13 Migrating Ansible content to a different collection You might decide to move content from one collection to another; for example, to extract a set of related m... 3 天前
  14. 14 Ansible collection creator path [!NOTE] If you are unfamiliar with Ansible collections, first take a look at the Using Ansible collections... 3 天前
  15. 15 Resource reporting Ansible modules often interact with external systems such as clouds, hypervisors, and network controllers t... 3 天前
  16. 16 Using shared resources in collections Although developing Ansible modules contained in collections is similar to developing standalone Ansible mo... 3 天前
  17. 17 Collection structure A collection is a simple data structure. None of the directories are required unless you have specific cont... 3 天前
  18. 18 Testing collections Testing your collection ensures that your code works well and integrates well with the rest of the Ansible ... 3 天前
  19. 19 Developing `ansible-core` Although ansible-core (the code hosted in the ansible/ansible repository on GitHub) includes a few plugins... 3 天前
  20. 20 Developing dynamic inventory Ansible can pull inventory information from dynamic sources, including cloud sources, by using the supplied... 3 天前
  21. 21 Adding modules and plugins locally<span id="using_local_modules_and_plugins"></span> You can extend Ansible by adding custom modules or plugins. You can create them from scratch or copy existi... 3 天前
  22. 22 Using and developing module utilities Ansible provides a number of module utilities, or snippets of shared code, that provide helper functions yo... 3 天前
  23. 23 Should you develop a module?<span id="developing_modules"></span> Developing Ansible modules is easy, but often it is not necessary. Before you start writing a new module, a... 3 天前
  24. 24 Conventions, tips, and pitfalls<span id="developing_modules_best_practices"></span> Topics As you design and develop modules, follow these basic conventions and tips for clean, usable code: S... 3 天前
  25. 25 Contributing your module to an existing Ansible collection<span id="developing_modules_checklist"></span> If you want to contribute a module to an existing collection, you must meet the community's objective and s... 3 天前
  26. 26 Module format and documentation<span id="developing_modules_documenting"></span> In most cases if you want to contribute your module to an Ansible collection, you should write your module ... 3 天前
  27. 27 Developing modules<span id="developing_modules_general"></span> A module is a reusable, standalone script that Ansible runs on your behalf, either locally or remotely. Mod... 3 天前
  28. 28 Windows module development walkthrough In this section, we will walk through developing, testing, and debugging an Ansible Windows module. Because... 3 天前
  29. 29 Creating a new collection Starting with Ansible 2.10, related modules should be developed in a collection. The Ansible Core team and ... 3 天前
  30. 30 Developing plugins<span id="developing_plugins"></span> Plugins augment Ansible's core functionality with logic and features that are accessible to all modules. An... 3 天前
  31. 31 Ansible module architecture<span id="flow_modules"></span> If you are working on the ansible-core code, writing an Ansible module, or developing an action plugin, yo... 3 天前
  32. 32 Ansible and Python 3 The ansible-core code runs Python 3 (for specific versions check Control Node Requirements <control_node_... 3 天前
  33. 33 Rebasing a pull request You may find that your pull request (PR) is out-of-date and needs to be rebased. This can happen for severa... 3 天前
  34. 34 Handling secrets in modules and plugins 2.22 ansible-core 2.22 adds a secret masking API that modules and plugins can use to register sensitive val... 3 天前
  35. 35 Migrating Roles to Roles in Collections on Galaxy You can migrate any existing standalone role into a collection and host the collection on Galaxy. With Ansi... 3 天前
  36. 36 The lifecycle of an Ansible module or plugin Modules and plugins in the main Ansible repository have a defined life cycle, from the first introduction t... 3 天前
  37. 37 Ansible architecture Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration managem... 3 天前
  38. 38 Adjacent YAML documentation files YAML documentation for plugins For most Ansible plugins, the documentation is in the same file as the code.... 3 天前
  39. 39 Basic rules Use standard American English Ansible uses Standard American English. Watch for common words that are spell... 3 天前
  40. 40 Grammar and Punctuation Common Styles and Usage, and Common Mistakes Ansible Write "Ansible." Not "Ansible, Inc." or "AnsibleWorks ... 3 天前
  41. 41 Ansible documentation style guide Welcome to the Ansible style guide! To create clear, concise, consistent, useful materials on docs.ansible.... 3 天前
  42. 42 Preferred terminology The following is the list of preferred terms for Ansible ecosystem projects. Ansible Use on all occurrences... 3 天前
  43. 43 Resources Follow the style of the Ansible Documentation<ansible_documentation> Ask the community for advice. Visit t... 3 天前
  44. 44 Writing documentation so search can find it One of the keys to writing good documentation is to make it findable. Readers use a combination of internal... 3 天前
  45. 45 Spelling - Word Usage - Common Words and Phrases to Use and Avoid Acronyms Always uppercase. An acronym is a word formed from the initial letters of a name, such as ROM for ... 3 天前
  46. 46 Trademark Usage Why is it important to use the TM, SM, and ® for our registered marks? Before a trademark is registered wit... 3 天前
  47. 47 Voice Style The essence of the Ansible writing style is short sentences that flow naturally together. Mix up sentence s... 3 天前
  48. 48 Testing Ansible testing_sanity testing_units testing_units_modules testing_integration testing_httptester testing_running_l... 3 天前
  49. 49 action-plugin-docs Each action plugin should have a matching module of the same name to provide documentation. 3 天前
  50. 50 ansible-doc Verifies that ansible-doc can parse module documentation on all supported Python versions. 3 天前
  51. 51 ansible-requirements test/lib/ansible_test/_data/requirements/sanity.import-plugins.txt must be an identical copy of requiremen... 3 天前
  52. 52 bin-symlinks The bin/ directory in Ansible must contain only symbolic links to executable files. These files must resid... 3 天前
  53. 53 boilerplate Python files should include the following boilerplate: from __future__ import annotations 3 天前
  54. 54 changelog Basic linting of changelog fragments with antsibull-changelog lint. One or more of the following sections a... 3 天前
  55. 55 compile All Python source files must successfully compile using all supported Python versions. [!NOTE] The list of ... 3 天前
  56. 56 deprecated-config DOCUMENTATION config is scheduled for removal 3 天前
  57. 57 empty-init The __init__.py files under the following directories must be empty. For some of these (modules and tests)... 3 天前
  58. 58 future-import-boilerplate Most Python files should include the following boilerplate at the top of the file, right after the comment ... 3 天前
  59. 59 ignores Sanity tests for individual files can be skipped, and specific errors can be ignored. When to Ignore Errors... 3 天前
  60. 60 import Ansible allows unchecked imports<allowed_unchecked_imports> of some libraries from specific directories. I... 3 天前
  61. 61 Sanity Tests The following sanity tests are available as --test options for ansible-test sanity when testing Ansible C... 3 天前
  62. 62 integration-aliases Integration tests are executed by ansible-test and reside in directories under test/integration/targets/.... 3 天前
  63. 63 line-endings All files must use \n for line endings instead of \r\n. 3 天前
  64. 64 mypy The mypy static type checker is used to check the following code against each Python version supported by ... 3 天前
  65. 65 no-assert Do not use assert in production Ansible python code. When running Python with optimizations, Python will r... 3 天前
  66. 66 no-basestring Do not use isinstance(s, basestring) as basestring has been removed in Python3. You can import string_typ... 3 天前
  67. 67 no-dict-iteritems The dict.iteritems method has been removed in Python 3. There are two recommended alternatives: for KEY, V... 3 天前
  68. 68 no-dict-iterkeys The dict.iterkeys method has been removed in Python 3. Use the following instead: for KEY in DICT: pass 3 天前
  69. 69 no-dict-itervalues The dict.itervalues method has been removed in Python 3. There are two recommended alternatives: for VALUE... 3 天前
  70. 70 no-get-exception We created a function, ansible.module_utils.pycompat24.get_exception to help retrieve exceptions in a mann... 3 天前
  71. 71 no-illegal-filenames Files and directories should not contain illegal characters or names so that Ansible can be checked out on ... 3 天前
  72. 72 no-main-display As of Ansible 2.8, Display should no longer be imported from __main__. Display is now a singleton and sho... 3 天前
  73. 73 no-smart-quotes Smart quotes ( ”“‘’) should not be used. Use plain ascii quotes ( "') instead. 3 天前
  74. 74 no-tests-as-filters orphan no-tests-as-filters Using Ansible provided Jinja2 tests as filters will be removed in Ansible 2.9. P... 3 天前
  75. 75 no-unicode-literals The use of from __future__ import unicode_literals has been deemed an anti-pattern. The problems with it a... 3 天前
  76. 76 no-unwanted-files Specific file types are allowed in certain directories: lib - All content must reside in the lib/ansible d... 3 天前
  77. 77 obsolete-files Directories in the Ansible source tree are sometimes made obsolete. Files should not exist in these directo... 3 天前
  78. 78 package-data Verifies the contents of the built ansible-core sdist and wheel. 3 天前
  79. 79 pep8 Python static analysis for PEP 8 style guideline compliance. PEP 8 style guidelines are enforced by pycodes... 3 天前
  80. 80 pslint PowerShell static analysis for common programming errors using PSScriptAnalyzer. 3 天前
  81. 81 pylint Python static analysis for common programming errors. 3 天前
  82. 82 pymarkdown Check Markdown files for syntax and formatting issues. 3 天前
  83. 83 release-names Verifies that the most recent release name has been added to ./github/RELEASE_NAMES.yml 3 天前
  84. 84 replace-urlopen Use open_url from module_utils instead of urlopen. 3 天前
  85. 85 required-and-default-attributes Use only one of default or required with FieldAttribute. 3 天前
  86. 86 runtime-metadata Validates the schema for: ansible-core's lib/ansible/config/ansible_builtin_runtime.yml collection's meta... 3 天前
  87. 87 shebang Most executable files should only use one of the following shebangs: #!/bin/sh #!/bin/bash -eu #!/bin/bash ... 3 天前
  88. 88 shellcheck Static code analysis for shell scripts using the excellent shellcheck tool. 3 天前
  89. 89 symlinks Symbolic links are only permitted for files that exist to ensure proper tarball generation during a release... 3 天前
  90. 90 test-constraints Constraints for test requirements should be in test/lib/ansible_test/_data/requirements/constraints.txt. 3 天前
  91. 91 update-bundled Check whether any of our known bundled code needs to be updated for a new upstream release. This test can e... 3 天前
  92. 92 use-argspec-type-path The AnsibleModule argument_spec knows of several types beyond the standard python types. One of these is p... 3 天前
  93. 93 use-compat-six Use six from module_utils instead of six. 3 天前
  94. 94 validate-modules Analyze modules for common issues in code and documentation. Usage cd /path/to/ansible/source source hackin... 3 天前
  95. 95 yamllint Check YAML files for syntax and formatting issues. 3 天前
  96. 96 Testing plugin documentation<span id="testing_module_documentation"></span> A quick test while developing is to use ansible-doc -t <plugin_type> <name> to see if it renders, you migh... 3 天前
  97. 97 httptester Topics Overview httptester is a docker container used to host certain resources required by testing_integr... 3 天前
  98. 98 Integration tests Topics The Ansible integration Test system. Tests for playbooks, by playbooks. Some tests may require crede... 3 天前
  99. 99 Testing Ansible and Collections This document describes how to run tests using ansible-test. Setup Before running ansible-test, set up yo... 3 天前
  100. 100 Sanity Tests Topics Sanity tests are made up of scripts and tools used to perform static code analysis. The primary purp... 3 天前
  101. 101 Unit Tests Unit tests are small isolated tests that target a specific library or module. Unit tests in Ansible are cur... 3 天前
  102. 102 Unit Testing Ansible Modules Topics Introduction This document explains why, how and when you should use unit tests for Ansible modules.... 3 天前