| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This Ansible collection contains modules to work with the public API for Servers.com. Documentation for the API is available at https://developers.servers.com.
You need to have an active account in servers.com (https://portal.servers.com). Some operations (new servers and instances, etc) require payments.
The modules try to support Ansible 2.9 or higher, but actual tests are done using currently supported versions of Ansible and Python.
You need the requests library for modules to work.
From Ansible Galaxy:
ansible-galaxy collection install serverscom.sc_api
From this repository:
Download latest release from Github Releases, and install it:
ansible-galaxy collection install https://github.com/serverscom/serverscom-ansible/... tar.gz
git clone https://github.com/serverscom/serverscom-ansible.git cd ansible_collections/serverscom/sc_api ansible-galaxy collection build
You need to issue a public API token from https://portal.servers.com/iam/api-tokens. You need an R/W token for doing any changes or ordering new resources. The token can be passed as environment variable (SERVERSCOM_API_TOKEN or SC_TOKEN) or as module parameter token. Precedence: token parameter > SERVERSCOM_API_TOKEN > SC_TOKEN.
You can see documentation for individual modules by calling (after installation) ansible-doc module_name, e.g. ansible-doc serverscom.sc_api.ssh_key.
Notes:
Old module names with sc_ prefix (e.g. serverscom.sc_api.sc_ssh_key) continue to work as aliases.
Baremetal Servers (Includes dedicated servers, SBM servers and kubernetes nodes)
Dedicated Servers (also known as Enterprise Baremetal Servers)
Cloud Computing
SSH Keys
L2 Segments (Network)
Load Balancers
RBS (Remote Block Storage)
SBM (Scalable Baremetal)
The collection ships a dynamic inventory plugin, serverscom.sc_api.sc_inventory, that builds Ansible inventory directly from the Servers.com API. It can fetch dedicated bare-metal servers, Scalable Bare-Metal (SBM), Kubernetes bare-metal nodes and cloud-computing instances; filter by location, name regexp, labels or status; exclude hosts; pick which IP becomes ansible_host; and place matched hosts into static or attribute-derived Ansible groups.
To use it, create an inventory file ending in .sc_api.yml (or .sc_inventory.yml) and set plugin: serverscom.sc_api.sc_inventory. The plugin picks up the API token from SERVERSCOM_API_TOKEN (or SC_TOKEN) the same way the modules do.
Minimal example — fetch every Servers.com resource with no filters:
# inventory.sc_api.yml
plugin: serverscom.sc_api.sc_inventoryRun it with:
export SERVERSCOM_API_TOKEN=... ansible-inventory -i inventory.sc_api.yml --list
A set of runnable examples covering region filters, label selection, exclusion rules, grouping, env-var substitution and multi-kind inventories lives under examples/dynamic_inventory/.
Full option reference: ansible-doc -t inventory serverscom.sc_api.sc_inventory.
| Back | FazBrowse Home | New Git URL |