CloudVE / cloudbridge

A consistent interface to multiple IaaS clouds; in Python.
https://cloudbridge.cloudve.org
MIT License
113 stars 51 forks source link

Create Ansible module for cloudbridge #311

Open nuwang opened 1 year ago

nuwang commented 1 year ago

An ansible module for cloudbridge would be of great use to anyone who needs to provision VMs and other cloud resources using simple yaml templates. The template will express the desired state of the resource.

A cloudbridge ansible module for creating a VM could look like the following:

- name: launch a cloudbridge instance
  cloudbridge_instance:
    state: present
    provider:
      type: aws
      aws_access_key_id: 
      aws_secret_access_key: 
    label: vm1
    image: ami-6e649707
    vm_type: m1.small
    key_pair: my_key_pair
    vm_firewalls: []
    user_data: ""        

Similarly, for creating a keypair:

- name: create a new key_pair
  cloudbridge_key_pair:
    state: present
    provider:
      type: gcp
    name: my_new_key_pair

Or a disk:

- name: create a new volume
  cloudbridge_volume:
    state: present
    provider:
      type: azure
   label: my_volume
   size: 10
   description: my postgres volume

Each module would need to inspect the current state of the object, and drive it towards the desired state. For example, if the vm instance does not exist, it would create it. However, if the vm instance exists but only the label has changed, it would rename it.

It would be best to take a phased approach and implement services incrementally so that multiple people can work on it. The ansible modules could be split as follows: