Skip to content

kollyma/ansible-cloudstack

 
 

Repository files navigation

Ansible Cloudstack Modules

Manages resources on Apache CloudStack, Citrix CloudPlatform and Exoscale.

Requirements

Uses Exosclale's python cs library: sudo pip install cs

Note: You can pass the API credentials by module arguments api_url, api_key and api_secret or even more comfortable by cloudstack.ini. Please see the https://github.com/exoscale/cs for more information.

Examples

# Upload an ISO (Note: this should have CloudStack SSH PubKey handling installed):
- local_action:
     module: cs_iso:
     name: Debian 7 64-bit
     url: http://iso.example.com/debian-cd/7.7.0/amd64/iso-cd/debian-7.7.0-amd64-netinst.iso
     os_type: Debian GNU/Linux 7(64-bit)
     checksum: 0b31bccccb048d20b551f70830bb7ad0


# Upload your SSH public key
- local_action:
    module: cs_sshkeypair
    name: john@example.com
    public_key: '{{ lookup('file', '~/.ssh/id_rsa.pub') }}'


# Ensure security group default exists
- local_action: 
    module: cs_securitygroup
    name: default


# Add inbound tcp rules to security group default
- local_action: 
    module: cs_securitygroup_rule
    security_group: default
    start_port: '{{ item }}'
    end_port: '{{ item }}'
  with_items:
  - 80
  - 8089


# Create a virtual machine on CloudStack
- local_action:
    module: cs_instance
    name: web-vm-1
    iso: Linux Debian 7 64-bit
    hypervisor: VMware
    service_offering: Tiny
    disk_offering: Performance
    disk_size: 20
    ssh_key: john@example.com


# Make a snapshot
- local_action:
    module: cs_vmsnapshot
    name: Snapshot before upgrade
    vm: web-vm-1
    snapshot_memory: yes


# Change service offering on existing VM
- local_action:
    module: cs_instance
    name: web-vm-1
    service_offering: Medium


# Stop a virtual machine
- local_action:
    module: cs_instance
    name: web-vm-1
    state: stopped


# Start a virtual machine
- local_action: cs_instance name=web-vm-1 state=started


# Remove a virtual machine on CloudStack
- local_action: cs_instance name=web-vm-1 state=absent

About

ansible modules for using cloudstack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.8%
  • Makefile 0.2%