Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Latest commit

 

History

History
109 lines (95 loc) · 2.53 KB

README.adoc

File metadata and controls

109 lines (95 loc) · 2.53 KB

cloudatcost-ansible-module

These are additional, unofficial Ansible modules for managing servers at CloudAtCost

Installation

Package Contents

cac_server.py

Module for managing cloudatcost servers in your playbooks

cac_inv.py

Cloudatcost Inventory script

In a virtualenv

 git clone https://github.com/sage905/cloudatcost-ansible-module
 cd cloudatcost-ansible-module
 pip install cloudatcost-ansible-module

Directly in playbook directory

 git clone https://github.com/sage905/cloudatcost-ansible-module
 ln -s $PWD/cloudatcost-ansible-module/cloudatcost-ansible-module/cac_server.py /path/to/your/ansible/library
 ln -s $PWD/cloudatcost-ansible-module/cac_inv.py /path/to/your/inventory/directory

Dependencies

This module depends on the python-cloudatcost module.

API Authentication

To use these modules, you must create an API key at the Cloudatcost Panel as described in the in the API documentation

You can use the api_key and api_user attributes of the server configuration, or use the CAC_API_KEY and CAC_API_USER environment variables, as so:

export CAC_API_KEY=apikeygeneratedbypanel
export [email protected]

Examples

Create a server

- local_action:
     module: cac_server
     api_user: [email protected]
     api_key: 'longStringFromCACApi'
     label: cloudatcost-test1
     cpus: 1
     ram: 1024
     storage: 10
     template_id: 26
     runmode: safe
     wait: yes
     wait_timeout: 3600
     state: present

Ensure a running server (create if missing)

- local_action:
     module: cac_server
     api_user: [email protected]
     api_key: 'longStringFromCaCAPI'
     label: cloudatcost-test1
     cpus: 1
     ram: 1024
     storage: 10
     template_id: 26
     runmode: safe
     wait: yes
     wait_timeout: 3600
     state: present

Delete a server

- local_action:
     module: cac_server
     api_user: [email protected]
     api_key: 'longStringFromCaCAPI'
     sid: 12345678
     label: cloudatcost-test1
     state: absent

Stop a server

- local_action:
     module: cac_server
     api_user: [email protected]
     api_key: 'longStringFromCaCAPI'
     label: cloudatcost-test1
     state: stopped

Reboot a server

- local_action:
     module: cac_server
     api_user: [email protected]
     api_key: 'longStringFromCaCAPI'
     label: cloudatcost-test1
     state: restarted