Moved inventory to plugins repo
This commit is contained in:
parent
c351c47cea
commit
68f07e83d9
3 changed files with 11 additions and 15 deletions
11
api.html
11
api.html
|
@ -267,9 +267,8 @@ command line tools <tt class="docutils literal"><span class="pre">ansible</span>
|
|||
<p>Often a user of a configuration management system will want to keep inventory
|
||||
in a different system. Frequent examples include LDAP, <a class="reference external" href="http://cobbler.github.com">Cobbler</a>,
|
||||
or a piece of expensive enterprisey CMDB software. Ansible easily supports all
|
||||
of these options via an external inventory system.</p>
|
||||
<p>If you have a data store system where an Ansible external inventory script doesn’t already exist, this may require a little coding, but we have a <a class="reference external" href="https://github.com/ansible/ansible/blob/devel/examples/scripts/cobbler_external_inventory.py">Cobbler example</a> in the main source tree – but it’s pretty simple, as we’ll explain below – that would provide a good starting point. Like with modules, it’s possible to build an external inventory script in any language, as long as it returns JSON.</p>
|
||||
<p>If you are familiar with Puppet terminology, this concept is basically the same as ‘external nodes’, with the slight difference that it also defines which hosts are managed.</p>
|
||||
of these options via an external inventory system. The <a class="reference external" href="http://github.com/ansible/ansible-plugins">ansible-plugins</a> repo contains some of these already.</p>
|
||||
<p>It’s possible to write an external inventory script in any language. If you are familiar with Puppet terminology, this concept is basically the same as ‘external nodes’, with the slight difference that it also defines which hosts are managed.</p>
|
||||
<div class="section" id="script-conventions">
|
||||
<h3>Script Conventions<a class="headerlink" href="#script-conventions" title="Permalink to this headline">¶</a></h3>
|
||||
<p>When the external node script is called with the single argument ‘–list’, the script must return a JSON hash/dictionary of all the groups to be managed, with a list of each host/IP as the value for each hash/dictionary element, like so:</p>
|
||||
|
@ -297,7 +296,7 @@ if the script does not wish to do this, returning an empty hash/dictionary is th
|
|||
layer that allows it to represent data for multiple configuration management systems (even at the same time), and has
|
||||
been referred to as a ‘lightweight CMDB’ by some admins. This particular script will communicate with Cobbler
|
||||
using Cobbler’s XMLRPC API.</p>
|
||||
<p>To tie Ansible’s inventory to Cobbler (optional), copy <cite>this script <https://github.com/ansible/ansible/blob/devel/examples/scripts/cobbler_external_inventory.py></cite> to /etc/ansible/hosts and <cite>chmod +x</cite> the file. cobblerd will now need
|
||||
<p>To tie Ansible’s inventory to Cobbler (optional), copy <a class="reference external" href="https://github.com/ansible/ansible-plugins/blob/master/inventory/cobbler.py">this script</a> to /etc/ansible/hosts and <cite>chmod +x</cite> the file. cobblerd will now need
|
||||
to be running when you are using Ansible.</p>
|
||||
<p>Test the file by running <cite>./etc/ansible/hosts</cite> directly. You should see some JSON data output, but it may not have
|
||||
anything in it just yet.</p>
|
||||
|
@ -338,10 +337,10 @@ a conf.d file appropriately or something similar. Who knows?</p>
|
|||
</div>
|
||||
<div class="section" id="example-aws-ec2-external-inventory-script">
|
||||
<h3>Example: AWS EC2 External Inventory Script<a class="headerlink" href="#example-aws-ec2-external-inventory-script" title="Permalink to this headline">¶</a></h3>
|
||||
<p>If you use Amazon Web Services EC2, maintaining an inventory file might not be the best approach. For this reason, you can use the <a class="reference external" href="https://github.com/ansible/ansible/blob/devel/examples/scripts/ec2_external_inventory.py">EC2 external inventory</a> script.</p>
|
||||
<p>If you use Amazon Web Services EC2, maintaining an inventory file might not be the best approach. For this reason, you can use the <a class="reference external" href="https://github.com/ansible/ansible-plugins/blob/master/inventory/ec2.py">EC2 external inventory</a> script.</p>
|
||||
<p>You can use this script in one of two ways. The easiest is to use Ansible’s <tt class="docutils literal"><span class="pre">-i</span></tt> command line option and specify the path to the script.</p>
|
||||
<blockquote>
|
||||
<div>ansible -i examples/scripts/ec2_external_inventory.py -u ubuntu us-east-1d -m ping</div></blockquote>
|
||||
<div>ansible -i ec2.py -u ubuntu us-east-1d -m ping</div></blockquote>
|
||||
<p>The second option is to copy the script to <cite>/etc/ansible/hosts</cite> and <cite>chmod +x</cite> it. You will also need to copy the <tt class="docutils literal"><span class="pre">ec2.ini</span></tt> file to <cite>/etc/ansible/ec2.ini</cite>. Then you can run ansible as you would normally.</p>
|
||||
<p>To successfully make an API call to AWS, you will need to configure Boto (the Python interface to AWS). There are a <a class="reference external" href="http://docs.pythonboto.org/en/latest/boto_config_tut.html">variety of methods</a> available, but the simplest is just to export two environment variables:</p>
|
||||
<blockquote>
|
||||
|
|
13
rst/api.rst
13
rst/api.rst
|
@ -87,12 +87,9 @@ External Inventory
|
|||
Often a user of a configuration management system will want to keep inventory
|
||||
in a different system. Frequent examples include LDAP, `Cobbler <http://cobbler.github.com>`_,
|
||||
or a piece of expensive enterprisey CMDB software. Ansible easily supports all
|
||||
of these options via an external inventory system.
|
||||
|
||||
If you have a data store system where an Ansible external inventory script doesn't already exist, this may require a little coding, but we have a `Cobbler example <https://github.com/ansible/ansible/blob/devel/examples/scripts/cobbler_external_inventory.py>`_ in the main source tree -- but it's pretty simple, as we'll explain below -- that would provide a good starting point. Like with modules, it's possible to build an external inventory script in any language, as long as it returns JSON.
|
||||
|
||||
If you are familiar with Puppet terminology, this concept is basically the same as 'external nodes', with the slight difference that it also defines which hosts are managed.
|
||||
of these options via an external inventory system. The `ansible-plugins <http://github.com/ansible/ansible-plugins>`_ repo contains some of these already.
|
||||
|
||||
It's possible to write an external inventory script in any language. If you are familiar with Puppet terminology, this concept is basically the same as 'external nodes', with the slight difference that it also defines which hosts are managed.
|
||||
|
||||
Script Conventions
|
||||
``````````````````
|
||||
|
@ -123,7 +120,7 @@ layer that allows it to represent data for multiple configuration management sys
|
|||
been referred to as a 'lightweight CMDB' by some admins. This particular script will communicate with Cobbler
|
||||
using Cobbler's XMLRPC API.
|
||||
|
||||
To tie Ansible's inventory to Cobbler (optional), copy `this script <https://github.com/ansible/ansible/blob/devel/examples/scripts/cobbler_external_inventory.py>` to /etc/ansible/hosts and `chmod +x` the file. cobblerd will now need
|
||||
To tie Ansible's inventory to Cobbler (optional), copy `this script <https://github.com/ansible/ansible-plugins/blob/master/inventory/cobbler.py>`_ to /etc/ansible/hosts and `chmod +x` the file. cobblerd will now need
|
||||
to be running when you are using Ansible.
|
||||
|
||||
Test the file by running `./etc/ansible/hosts` directly. You should see some JSON data output, but it may not have
|
||||
|
@ -174,11 +171,11 @@ So that's the Cobbler integration support -- using the cobbler script as an exam
|
|||
Example: AWS EC2 External Inventory Script
|
||||
``````````````````````````````````````````
|
||||
|
||||
If you use Amazon Web Services EC2, maintaining an inventory file might not be the best approach. For this reason, you can use the `EC2 external inventory <https://github.com/ansible/ansible/blob/devel/examples/scripts/ec2_external_inventory.py>`_ script.
|
||||
If you use Amazon Web Services EC2, maintaining an inventory file might not be the best approach. For this reason, you can use the `EC2 external inventory <https://github.com/ansible/ansible-plugins/blob/master/inventory/ec2.py>`_ script.
|
||||
|
||||
You can use this script in one of two ways. The easiest is to use Ansible's ``-i`` command line option and specify the path to the script.
|
||||
|
||||
ansible -i examples/scripts/ec2_external_inventory.py -u ubuntu us-east-1d -m ping
|
||||
ansible -i ec2.py -u ubuntu us-east-1d -m ping
|
||||
|
||||
The second option is to copy the script to `/etc/ansible/hosts` and `chmod +x` it. You will also need to copy the ``ec2.ini`` file to `/etc/ansible/ec2.ini`. Then you can run ansible as you would normally.
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue