2018-09-21 16:43:56 +00:00
|
|
|
*************************
|
|
|
|
Using Ansible with Online
|
|
|
|
*************************
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
============
|
|
|
|
|
|
|
|
Online is a French hosting company mainly known for providing bare-metal servers named Dedibox.
|
2018-10-17 14:28:48 +00:00
|
|
|
Check it out: `https://www.online.net/en <https://www.online.net/en>`_
|
2018-09-21 16:43:56 +00:00
|
|
|
|
|
|
|
Dynamic inventory for Online resources
|
|
|
|
--------------------------------------
|
|
|
|
|
|
|
|
Ansible has a dynamic inventory plugin that can list your resources.
|
|
|
|
|
|
|
|
1. Create a YAML configuration such as ``online_inventory.yml`` with this content:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
plugin: online
|
|
|
|
|
|
|
|
2. Set your ``ONLINE_TOKEN`` environment variable with your token.
|
|
|
|
You need to open an account and log into it before you can get a token.
|
2018-10-17 14:28:48 +00:00
|
|
|
You can find your token at the following page: `https://console.online.net/en/api/access <https://console.online.net/en/api/access>`_
|
2018-09-21 16:43:56 +00:00
|
|
|
|
2018-12-20 21:50:10 +00:00
|
|
|
3. You can test that your inventory is working by running:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ ansible-inventory -v -i online_inventory.yml --list
|
|
|
|
|
2018-09-21 16:43:56 +00:00
|
|
|
|
|
|
|
4. Now you can run your playbook or any other module with this inventory:
|
|
|
|
|
2018-12-20 21:50:10 +00:00
|
|
|
.. code-block:: console
|
2018-09-21 16:43:56 +00:00
|
|
|
|
|
|
|
$ ansible all -i online_inventory.yml -m ping
|
|
|
|
sd-96735 | SUCCESS => {
|
|
|
|
"changed": false,
|
|
|
|
"ping": "pong"
|
|
|
|
}
|