1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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 = '''
# Create a instance from an ISO
# NOTE: Names of offerings and ISOs depending on the CloudStack configuration.
- local_action:
module: cs_instance
- cs_instance:
name: web-vm-1
iso: Linux Debian 7 64-bit
hypervisor: VMware
@ -237,50 +236,64 @@ EXAMPLES = '''
- Server Integration
- Sync Integration
- Storage Integration
delegate_to: localhost
# For changing a running instance, use the 'force' parameter
- local_action:
module: cs_instance
- cs_instance:
name: web-vm-1
display_name: web-vm-01.example.com
iso: Linux Debian 7 64-bit
service_offering: 2cpu_2gb
force: yes
delegate_to: localhost
# 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.
- local_action:
module: cs_instance
- cs_instance:
display_name: web-vm-1
template: Linux Debian 7 64-bit
service_offering: Tiny
ssh_key: john@example.com
tags:
- { key: admin, value: john }
- { key: foo, value: bar }
- key: admin
value: john
- key: foo
value: bar
user_data: |
#cloud-config
packages:
- nginx
delegate_to: localhost
# Create an instance with multiple interfaces specifying the IP addresses
- local_action:
module: cs_instance
- cs_instance:
name: web-vm-1
template: Linux Debian 7 64-bit
service_offering: Tiny
ip_to_networks:
- {'network': NetworkA, 'ip': '10.1.1.1'}
- {'network': NetworkB, 'ip': '192.168.1.1'}
- network: NetworkA
ip: 10.1.1.1
- network: NetworkB
ip: 192.0.2.1
delegate_to: localhost
# 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
- local_action: cs_instance name=web-vm-1 state=started
- cs_instance:
name: web-vm-1
state: started
delegate_to: localhost
# 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 = '''

View file

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

View file

@ -64,15 +64,24 @@ extends_documentation_fragment: cloudstack
EXAMPLES = '''
# 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
- debug: msg='private key is {{ key.private_key }}'
- debug:
msg: 'Private key is {{ key.private_key }}'
# 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:
- 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 = '''

View file

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