CINXE.COM

Ansible architecture — Ansible Community Documentation

<!DOCTYPE html> <html class="writer-html5" lang="en" data-content_root="../"> <head> <meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Ansible architecture &mdash; Ansible Community Documentation</title> <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=5707b69d" /> <link rel="stylesheet" type="text/css" href="../_static/css/ansible.css?v=c5b67dd2" /> <link rel="stylesheet" type="text/css" href="../_static/antsibull-minimal.css" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/css/rtd-ethical-ads.css?v=289b023e" /> <link rel="shortcut icon" href="../_static/images/Ansible-Mark-RGB_Black.png"/> <link rel="canonical" href="https://docs.ansible.com/ansible/latest/dev_guide/overview_architecture.html"/> <script src="../_static/jquery.js?v=5d32c60e"></script> <script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> <script src="../_static/documentation_options.js?v=8ff10258"></script> <script src="../_static/doctools.js?v=888ff710"></script> <script src="../_static/sphinx_highlight.js?v=dc90522c"></script> <script src="../_static/clipboard.min.js?v=a7894cd8"></script> <script src="../_static/copybutton.js?v=f281be69"></script> <script src="../_static/js/theme.js"></script> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="Legacy Public Cloud Guides" href="../scenario_guides/cloud_guides.html" /> <link rel="prev" title="Migrating Roles to Roles in Collections on Galaxy" href="migrating_roles.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme --> <script src="https://www.redhat.com/dtm.js"></script> <!-- Google Tag Manager Data Layer --> <script> dataLayer = []; </script> <!-- End Google Tag Manager Data Layer --> </head> <body class="wy-body-for-nav"><!-- extra body elements for Ansible beyond RTD Sphinx Theme --> <!-- Google Tag Manager --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PSB293" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-PSB293');</script> <!-- End Google Tag Manager --> <div class="DocSite-globalNav ansibleNav"> <ul> <li><a href="https://www.ansible.com/blog" target="_blank">Blog</a></li> <li><a href="https://forum.ansible.com/" target="_blank">Ansible community forum</a></li> <li><a href="https://docs.ansible.com/" target="_blank">Documentation</a></li> </ul> </div> <a class="DocSite-nav" href="/" style="padding-bottom: 30px;"> <img class="DocSiteNav-logo" src="../_static/images/Ansible-Mark-RGB_White.png" alt="Ansible Logo"> <div class="DocSiteNav-title">Ansible Community Documentation</div> </a> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search" > <a href="../index.html" class="icon icon-home"> Ansible </a><!--- Based on https://github.com/rtfd/sphinx_rtd_theme/pull/438/files --> <div class="version"> <form class="version-dropdown" method="get"> <script> function switchVersionTo(slug) { var current_url_path = window.location.pathname; var url_version = current_url_path.search("/11/") > -1 ? "/11/" : "/latest/"; var new_version_url = current_url_path.replace(url_version, "/" + slug + "/"); window.location.replace(new_version_url); } </script> <label class="sr-only" for="version-list">Select version:</label> <select class="version-list" id="version-list" onchange="switchVersionTo(this.value);" > <option value="latest" > latest </option> <option value="2.9" > 2.9 </option> <option value="devel" > devel </option> </select> </form> </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> <label class="sr-only" for="q">Search docs:</label> <input type="text" class="st-default-search-input" id="q" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> <p class="caption" role="heading"><span class="caption-text">Ansible getting started</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../getting_started/index.html">Getting started with Ansible</a></li> <li class="toctree-l1"><a class="reference internal" href="../getting_started_ee/index.html">Getting started with Execution Environments</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Installation, Upgrade &amp; Configuration</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../installation_guide/index.html">Installation Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../porting_guides/porting_guides.html">Ansible Porting Guides</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Using Ansible</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../inventory_guide/index.html">Building Ansible inventories</a></li> <li class="toctree-l1"><a class="reference internal" href="../command_guide/index.html">Using Ansible command line tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../playbook_guide/index.html">Using Ansible playbooks</a></li> <li class="toctree-l1"><a class="reference internal" href="../vault_guide/index.html">Protecting sensitive data with Ansible vault</a></li> <li class="toctree-l1"><a class="reference internal" href="../module_plugin_guide/index.html">Using Ansible modules and plugins</a></li> <li class="toctree-l1"><a class="reference internal" href="../collections_guide/index.html">Using Ansible collections</a></li> <li class="toctree-l1"><a class="reference internal" href="../os_guide/index.html">Using Ansible on Windows and BSD</a></li> <li class="toctree-l1"><a class="reference internal" href="../tips_tricks/index.html">Ansible tips and tricks</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Contributing to Ansible</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../community/index.html">Ansible Community Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../community/contributions_collections.html">Ansible Collections Contributor Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../community/contributions.html">ansible-core Contributors Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../community/advanced_index.html">Advanced Contributor Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="style_guide/index.html">Ansible documentation style guide</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Extending Ansible</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="index.html">Developer Guide</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Common Ansible Scenarios</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../scenario_guides/cloud_guides.html">Legacy Public Cloud Guides</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Network Automation</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../network/getting_started/index.html">Network Getting Started</a></li> <li class="toctree-l1"><a class="reference internal" href="../network/user_guide/index.html">Network Advanced Topics</a></li> <li class="toctree-l1"><a class="reference internal" href="../network/dev_guide/index.html">Network Developer Guide</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Ansible Galaxy</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../galaxy/user_guide.html">Galaxy User Guide</a></li> <li class="toctree-l1"><a class="reference internal" href="../galaxy/dev_guide.html">Galaxy Developer Guide</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Reference &amp; Appendices</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../collections/index.html">Collection Index</a></li> <li class="toctree-l1"><a class="reference internal" href="../collections/all_plugins.html">Indexes of all modules and plugins</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/playbooks_keywords.html">Playbook Keywords</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/common_return_values.html">Return Values</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/config.html">Ansible Configuration Settings</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/general_precedence.html">Controlling how Ansible behaves: precedence rules</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/YAMLSyntax.html">YAML Syntax</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/python_3_support.html">Python 3 Support</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/interpreter_discovery.html">Interpreter Discovery</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/release_and_maintenance.html">Releases and maintenance</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/test_strategies.html">Testing Strategies</a></li> <li class="toctree-l1"><a class="reference internal" href="testing/sanity/index.html">Sanity Tests</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/faq.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/glossary.html">Glossary</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/module_utils.html">Ansible Reference: Module Utilities</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/special_variables.html">Special Variables</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/tower.html">Red Hat Ansible Automation Platform</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/automationhub.html">Ansible Automation Hub</a></li> <li class="toctree-l1"><a class="reference internal" href="../reference_appendices/logging.html">Logging Ansible output</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Roadmaps</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="../roadmap/ansible_roadmap_index.html">Ansible Roadmap</a></li> <li class="toctree-l1"><a class="reference internal" href="../roadmap/ansible_core_roadmap_index.html">ansible-core Roadmaps</a></li> </ul> <!-- extra nav elements for Ansible beyond RTD Sphinx Theme --> <!-- changeable widget links to tower - do not change as image controlled by Ansible--> <div id="sideBanner"> <br/> <a href="https://www.ansible.com/docs-left?utm_source=docs"> <img style="border-width:0px;" src="https://cdn2.hubspot.net/hubfs/330046/docs-graphics/ASB-docs-left-rail.png" /> </a> <br/><br/><br/> </div> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="../index.html">Ansible</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="Page navigation"> <ul class="wy-breadcrumbs"> <li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li> <li class="breadcrumb-item"><a href="index.html">Developer Guide</a></li> <li class="breadcrumb-item active">Ansible architecture</li> <li class="wy-breadcrumbs-aside"> <!-- Remove main index page as it is no longer editable --> <a href="https://github.com/ansible/ansible-documentation/edit/devel/docs/docsite/rst/dev_guide/overview_architecture.rst?description=%23%23%23%23%23%20SUMMARY%0A%3C!---%20Your%20description%20here%20--%3E%0A%0A%0A%23%23%23%23%23%20ISSUE%20TYPE%0A-%20Docs%20Pull%20Request%0A%0A%2Blabel:%20docsite_pr" class="fa fa-github"> Edit on GitHub</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <script> function startsWith(str, needle) { return str.slice(0, needle.length) == needle } function startsWithOneOf(str, needles) { return needles.some(function (needle) { return startsWith(str, needle); }); } var banner = ''; /*use extra_banner for when we want something extra, like a survey or Community Day notice */ var extra_banner = ''; /* var extra_banner = '<div id="latest_extra_banner_id" class="admonition important">' + '<p style="font-size: 1.5rem;text-align: center;">' + 'Take the <a href="https://www.surveymonkey.com/r/P9Q2SNG">Ansible Project Survey 2024</a>!' + '</p>' + '<p style="padding-bottom: 1.2rem;text-align: center">' + 'We want to hear from you! Help us gain insights into the state of the Ansible ecosystem.' + '</p>' + '</div>'; */ // Create a banner if we're not on the official docs site if (location.host == "docs.testing.ansible.com") { document.write('<div id="testing_banner_id" class="admonition important">' + '<p>This is the testing site for Ansible Documentation. Unless you are reviewing pre-production changes, please visit the <a href="https://docs.ansible.com/ansible/latest/">official documentation website</a>.</p> <p></p>' + '</div>'); } // Create a banner current_url_path = window.location.pathname; var important = false; var msg = '<p>'; if (startsWith(current_url_path, "/ansible-core/")) { msg += 'You are reading documentation for Ansible Core, which contains no plugins except for those in ansible.builtin. For documentation of the Ansible package, go to <a href="/ansible/latest">the latest documentation</a>.'; } else if (startsWithOneOf(current_url_path, ["/ansible/latest/", "/ansible/11/"])) { /* temp extra banner to advertise something */ banner += extra_banner; msg += 'This is the <b>latest</b> (stable) Ansible community documentation. For Red Hat Ansible Automation Platform subscriptions, see <a href="https://access.redhat.com/support/policy/updates/ansible-automation-platform">Life Cycle</a> for version details.'; } else if (startsWith(current_url_path, "/ansible/2.9/")) { msg += 'You are reading the latest Red Hat released version of the Ansible documentation. Community users can use this version, or select <b>latest</b> from the version selector to the left for the most recent community version.'; } else if (startsWith(current_url_path, "/ansible/devel/")) { /* temp extra banner to advertise something */ banner += extra_banner; msg += 'You are reading the <b>devel</b> version of the Ansible documentation - this version is not guaranteed stable. Use the version selection to the left if you want the <b>latest</b> (stable) released version.'; } else { msg += 'You are reading an older version of the Ansible documentation. Use the version selection to the left if you want the <b>latest</b> (stable) released version.'; /* temp extra banner to advertise something - this is for testing*/ banner += extra_banner; } msg += '</p>'; banner += '<div id="banner_id" class="admonition '; banner += important ? 'important' : 'caution'; banner += '">'; banner += important ? '<br>' : ''; banner += msg; banner += important ? '<br>' : ''; banner += '</div>'; document.write(banner); </script> <div itemprop="articleBody"> <section id="ansible-architecture"> <h1>Ansible architecture<a class="headerlink" href="#ansible-architecture" title="Link to this heading"></a></h1> <p>Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.</p> <p>Being designed for multi-tier deployments since day one, Ansible models your IT infrastructure by describing how all of your systems inter-relate, rather than just managing one system at a time.</p> <p>It uses no agents and no additional custom security infrastructure, so it is easy to deploy - and most importantly, it uses a very simple language (YAML, in the form of Ansible Playbooks) that allows you to describe your automation jobs in a way that approaches plain English.</p> <p>In this section, we’ll give you a really quick overview of how Ansible works so you can see how the pieces fit together.</p> <nav class="contents local" id="contents"> <ul class="simple"> <li><p><a class="reference internal" href="#modules" id="id1">Modules</a></p></li> <li><p><a class="reference internal" href="#module-utilities" id="id2">Module utilities</a></p></li> <li><p><a class="reference internal" href="#plugins" id="id3">Plugins</a></p></li> <li><p><a class="reference internal" href="#inventory" id="id4">Inventory</a></p></li> <li><p><a class="reference internal" href="#playbooks" id="id5">Playbooks</a></p></li> <li><p><a class="reference internal" href="#the-ansible-search-path" id="id6">The Ansible search path</a></p></li> </ul> </nav> <section id="modules"> <h2><a class="toc-backref" href="#id1" role="doc-backlink">Modules</a><a class="headerlink" href="#modules" title="Link to this heading"></a></h2> <p>Ansible works by connecting to your nodes and pushing out scripts called “Ansible modules” to them. Most modules accept parameters that describe the desired state of the system. Ansible then executes these modules (over SSH by default), and removes them when finished. Your library of modules can reside on any machine, and there are no servers, daemons, or databases required.</p> <p>You can <a class="reference internal" href="developing_modules_general.html#developing-modules-general"><span class="std std-ref">write your own modules</span></a>, though you should first consider <a class="reference internal" href="developing_modules.html#developing-modules"><span class="std std-ref">whether you should</span></a>. Typically you’ll work with your favorite terminal program, a text editor, and probably a version control system to keep track of changes to your content. You may write specialized modules in any language that can return JSON (Ruby, Python, bash, and so on).</p> </section> <section id="module-utilities"> <h2><a class="toc-backref" href="#id2" role="doc-backlink">Module utilities</a><a class="headerlink" href="#module-utilities" title="Link to this heading"></a></h2> <p>When multiple modules use the same code, Ansible stores those functions as module utilities to minimize duplication and maintenance. For example, the code that parses URLs is <code class="docutils literal notranslate"><span class="pre">lib/ansible/module_utils/url.py</span></code>. You can <a class="reference internal" href="developing_module_utilities.html#developing-module-utilities"><span class="std std-ref">write your own module utilities</span></a> as well. Module utilities may only be written in Python or in PowerShell.</p> </section> <section id="plugins"> <h2><a class="toc-backref" href="#id3" role="doc-backlink">Plugins</a><a class="headerlink" href="#plugins" title="Link to this heading"></a></h2> <p><a class="reference internal" href="../plugins/plugins.html#plugins-lookup"><span class="std std-ref">Plugins</span></a> augment Ansible’s core functionality. While modules execute on the target system in separate processes (usually that means on a remote system), plugins execute on the control node within the <code class="docutils literal notranslate"><span class="pre">/usr/bin/ansible</span></code> process. Plugins offer options and extensions for the core features of Ansible - transforming data, logging output, connecting to inventory, and more. Ansible ships with a number of handy plugins, and you can easily <a class="reference internal" href="developing_plugins.html#developing-plugins"><span class="std std-ref">write your own</span></a>. For example, you can write an <a class="reference internal" href="developing_inventory.html#developing-inventory"><span class="std std-ref">inventory plugin</span></a> to connect to any datasource that returns JSON. Plugins must be written in Python.</p> </section> <section id="inventory"> <h2><a class="toc-backref" href="#id4" role="doc-backlink">Inventory</a><a class="headerlink" href="#inventory" title="Link to this heading"></a></h2> <p>By default, Ansible represents the machines it manages in a file (INI, YAML, and so on) that puts all of your managed machines in groups of your own choosing.</p> <p>To add new machines, there is no additional SSL signing server involved, so there’s never any hassle deciding why a particular machine didn’t get linked up due to obscure NTP or DNS issues.</p> <p>If there’s another source of truth in your infrastructure, Ansible can also connect to that. Ansible can draw inventory, group, and variable information from sources like EC2, Rackspace, OpenStack, and more.</p> <p>Here’s what a plain text inventory file looks like:</p> <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>[webservers] www1.example.com www2.example.com [dbservers] db0.example.com db1.example.com </pre></div> </div> <p>Once inventory hosts are listed, variables can be assigned to them in simple text files (in a subdirectory called ‘group_vars/’ or ‘host_vars/’) or directly in the inventory file.</p> <p>Or, as already mentioned, use a dynamic inventory to pull your inventory from data sources like EC2, Rackspace, or OpenStack.</p> </section> <section id="playbooks"> <h2><a class="toc-backref" href="#id5" role="doc-backlink">Playbooks</a><a class="headerlink" href="#playbooks" title="Link to this heading"></a></h2> <p>Playbooks can finely orchestrate multiple slices of your infrastructure topology, with very detailed control over how many machines to tackle at a time. This is where Ansible starts to get most interesting.</p> <p>Ansible’s approach to orchestration is one of finely-tuned simplicity, as we believe your automation code should make perfect sense to you years down the road and there should be very little to remember about special syntax or features.</p> <p>Here’s what a simple playbook looks like:</p> <div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nn">---</span> <span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">hosts</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">webservers</span> <span class="w"> </span><span class="nt">serial</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">5</span><span class="w"> </span><span class="c1"># update 5 machines at a time</span> <span class="w"> </span><span class="nt">roles</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">common</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">webapp</span> <span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">hosts</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">content_servers</span> <span class="w"> </span><span class="nt">roles</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">common</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">content</span> </pre></div> </div> </section> <section id="the-ansible-search-path"> <span id="ansible-search-path"></span><h2><a class="toc-backref" href="#id6" role="doc-backlink">The Ansible search path</a><a class="headerlink" href="#the-ansible-search-path" title="Link to this heading"></a></h2> <p>Modules, module utilities, plugins, playbooks, and roles can live in multiple locations. If you write your own code to extend Ansible’s core features, you may have multiple files with similar or the same names in different locations on your Ansible control node. The search path determines which of these files Ansible will discover and use on any given playbook run.</p> <p>Ansible’s search path grows incrementally over a run. As Ansible finds each playbook and role included in a given run, it appends any directories related to that playbook or role to the search path. Those directories remain in scope for the duration of the run, even after the playbook or role has finished executing. Ansible loads modules, module utilities, and plugins in this order:</p> <ol class="arabic"> <li><p>Directories adjacent to a playbook specified on the command line. If you run Ansible with <code class="docutils literal notranslate"><span class="pre">ansible-playbook</span> <span class="pre">/path/to/play.yml</span></code>, Ansible appends these directories if they exist:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/path/to/modules /path/to/module_utils /path/to/plugins </pre></div> </div> </li> <li><p>Directories adjacent to a playbook that is statically imported by a playbook specified on the command line. If <code class="docutils literal notranslate"><span class="pre">play.yml</span></code> includes <code class="docutils literal notranslate"><span class="pre">-</span> <span class="pre">import_playbook:</span> <span class="pre">/path/to/subdir/play1.yml</span></code>, Ansible appends these directories if they exist:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/path/to/subdir/modules /path/to/subdir/module_utils /path/to/subdir/plugins </pre></div> </div> </li> <li><p>Subdirectories of a role directory referenced by a playbook. If <code class="docutils literal notranslate"><span class="pre">play.yml</span></code> runs <code class="docutils literal notranslate"><span class="pre">myrole</span></code>, Ansible appends these directories if they exist:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>/path/to/roles/myrole/modules /path/to/roles/myrole/module_utils /path/to/roles/myrole/plugins </pre></div> </div> </li> <li><p>Directories specified as default paths in <code class="docutils literal notranslate"><span class="pre">ansible.cfg</span></code> or by the related environment variables, including the paths for the various plugin types. See <a class="reference internal" href="../reference_appendices/config.html#ansible-configuration-settings"><span class="std std-ref">Ansible Configuration Settings</span></a> for more information. Sample <code class="docutils literal notranslate"><span class="pre">ansible.cfg</span></code> fields:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>DEFAULT_MODULE_PATH DEFAULT_MODULE_UTILS_PATH DEFAULT_CACHE_PLUGIN_PATH DEFAULT_FILTER_PLUGIN_PATH </pre></div> </div> <p>Sample environment variables:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>ANSIBLE_LIBRARY ANSIBLE_MODULE_UTILS ANSIBLE_CACHE_PLUGINS ANSIBLE_FILTER_PLUGINS </pre></div> </div> </li> <li><p>The standard directories that ship as part of the Ansible distribution.</p></li> </ol> <div class="admonition caution"> <p class="admonition-title">Caution</p> <p>Modules, module utilities, and plugins in user-specified directories will override the standard versions. This includes some files with generic names. For example, if you have a file named <code class="docutils literal notranslate"><span class="pre">basic.py</span></code> in a user-specified directory, it will override the standard <code class="docutils literal notranslate"><span class="pre">ansible.module_utils.basic</span></code>.</p> <p>If you have more than one module, module utility, or plugin with the same name in different user-specified directories, the order of commands at the command line and the order of includes and roles in each play will affect which one is found and used on that particular play.</p> </div> </section> </section> </div> </div> <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> <a href="migrating_roles.html" class="btn btn-neutral float-left" title="Migrating Roles to Roles in Collections on Galaxy" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> <a href="../scenario_guides/cloud_guides.html" class="btn btn-neutral float-right" title="Legacy Public Cloud Guides" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> </div> <hr/> <div role="contentinfo"> <p>&#169; Copyright Ansible project contributors. <span class="lastupdated">Last updated on Nov 20, 2024. </span></p> </div> </footer> </div> </div> </section> </div> <script> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script><!-- extra footer elements for Ansible beyond RTD Sphinx Theme --> <!-- begin analytics --> <script> var _hsq = _hsq || []; _hsq.push(["setContentType", "standard-page"]); (function(d,s,i,r) { if (d.getElementById(i)){return;} var n = d.createElement(s),e = document.getElementsByTagName(s)[0]; n.id=i;n.src = 'https://js.hs-analytics.net/analytics/'+(Math.ceil(new Date()/r)*r)+'/330046.js'; e.parentNode.insertBefore(n, e); })(document, "script", "hs-analytics",300000); </script> <!-- end analytics --> <script> if (("undefined" !== typeof _satellite) && ("function" === typeof _satellite.pageBottom)) { _satellite.pageBottom(); } </script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10