Native YAML - cloud/cloudstack (#3613)

This commit is contained in:
Fabio Alessandro Locati 2016-12-01 16:40:49 +00:00 committed by Matt Clay
parent 00eb0d27d9
commit 1a7b9090df
4 changed files with 49 additions and 25 deletions

View file

@ -223,8 +223,7 @@ extends_documentation_fragment: cloudstack
EXAMPLES = ''' EXAMPLES = '''
# Create a instance from an ISO # Create a instance from an ISO
# NOTE: Names of offerings and ISOs depending on the CloudStack configuration. # NOTE: Names of offerings and ISOs depending on the CloudStack configuration.
- local_action: - cs_instance:
module: cs_instance
name: web-vm-1 name: web-vm-1
iso: Linux Debian 7 64-bit iso: Linux Debian 7 64-bit
hypervisor: VMware hypervisor: VMware
@ -237,50 +236,64 @@ EXAMPLES = '''
- Server Integration - Server Integration
- Sync Integration - Sync Integration
- Storage Integration - Storage Integration
delegate_to: localhost
# For changing a running instance, use the 'force' parameter # For changing a running instance, use the 'force' parameter
- local_action: - cs_instance:
module: cs_instance
name: web-vm-1 name: web-vm-1
display_name: web-vm-01.example.com display_name: web-vm-01.example.com
iso: Linux Debian 7 64-bit iso: Linux Debian 7 64-bit
service_offering: 2cpu_2gb service_offering: 2cpu_2gb
force: yes force: yes
delegate_to: localhost
# Create or update a instance on Exoscale's public cloud using display_name. # Create or update a instance on Exoscale's public cloud using display_name.
# Note: user_data can be used to kickstart the instance using cloud-init yaml config. # Note: user_data can be used to kickstart the instance using cloud-init yaml config.
- local_action: - cs_instance:
module: cs_instance
display_name: web-vm-1 display_name: web-vm-1
template: Linux Debian 7 64-bit template: Linux Debian 7 64-bit
service_offering: Tiny service_offering: Tiny
ssh_key: john@example.com ssh_key: john@example.com
tags: tags:
- { key: admin, value: john } - key: admin
- { key: foo, value: bar } value: john
- key: foo
value: bar
user_data: | user_data: |
#cloud-config #cloud-config
packages: packages:
- nginx - nginx
delegate_to: localhost
# Create an instance with multiple interfaces specifying the IP addresses # Create an instance with multiple interfaces specifying the IP addresses
- local_action: - cs_instance:
module: cs_instance
name: web-vm-1 name: web-vm-1
template: Linux Debian 7 64-bit template: Linux Debian 7 64-bit
service_offering: Tiny service_offering: Tiny
ip_to_networks: ip_to_networks:
- {'network': NetworkA, 'ip': '10.1.1.1'} - network: NetworkA
- {'network': NetworkB, 'ip': '192.168.1.1'} ip: 10.1.1.1
- network: NetworkB
ip: 192.0.2.1
delegate_to: localhost
# Ensure an instance is stopped # Ensure an instance is stopped
- local_action: cs_instance name=web-vm-1 state=stopped - cs_instance:
name: web-vm-1
state: stopped
delegate_to: localhost
# Ensure an instance is running # Ensure an instance is running
- local_action: cs_instance name=web-vm-1 state=started - cs_instance:
name: web-vm-1
state: started
delegate_to: localhost
# Remove an instance # Remove an instance
- local_action: cs_instance name=web-vm-1 state=absent - cs_instance:
name: web-vm-1
state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -50,11 +50,12 @@ extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
- local_action: - cs_instance_facts:
module: cs_instance_facts
name: web-vm-1 name: web-vm-1
delegate_to: localhost
- debug: var=cloudstack_instance - debug:
var: cloudstack_instance
''' '''
RETURN = ''' RETURN = '''

View file

@ -64,15 +64,24 @@ extends_documentation_fragment: cloudstack
EXAMPLES = ''' EXAMPLES = '''
# create a new private / public key pair: # create a new private / public key pair:
- local_action: cs_sshkeypair name=linus@example.com - cs_sshkeypair:
name: linus@example.com
delegate_to: localhost
register: key register: key
- debug: msg='private key is {{ key.private_key }}' - debug:
msg: 'Private key is {{ key.private_key }}'
# remove a public key by its name: # remove a public key by its name:
- local_action: cs_sshkeypair name=linus@example.com state=absent - cs_sshkeypair:
name: linus@example.com
state: absent
delegate_to: localhost
# register your existing local public key: # register your existing local public key:
- local_action: cs_sshkeypair name=linus@example.com public_key='{{ lookup('file', '~/.ssh/id_rsa.pub') }}' - cs_sshkeypair:
name: linus@example.com
public_key: '{{ lookup('file', '~/.ssh/id_rsa.pub') }}'
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -35,11 +35,12 @@ extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
- local_action: - cs_zone_facts:
module: cs_zone_facts
name: ch-gva-1 name: ch-gva-1
delegate_to: localhost
- debug: var=cloudstack_zone - debug:
var: cloudstack_zone
''' '''
RETURN = ''' RETURN = '''