mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Examples syntax batch6 (#5623)
* Change example syntax on os_auth module * Change example syntax on os_client_config module * Change example syntax on os_image_facts module * Change example syntax on os_networks_facts module * Change example syntax on os_nova_flavor module * Change example syntax on os_object module * Change example syntax on os_server module * Change example syntax on os_subnet_facts module * Change example syntax on rax_files module * Change example syntax on rax_files_objects module * Change example syntax on mysql_db module * Change example syntax on file module * Change example syntax on uri module * Change example syntax on cl_bond module * Change example syntax on cl_bridge module * Change example syntax on cl_img_install module * Change example syntax on cl_interface module * Change example syntax on cl_license module * Change example syntax on cl_ports module * Remove trailing colon
This commit is contained in:
@@ -34,10 +34,13 @@ extends_documentation_fragment: openstack
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Authenticate to the cloud and retreive the service catalog
|
||||
- os_auth:
|
||||
- name: Authenticate to the cloud and retrieve the service catalog
|
||||
os_auth:
|
||||
cloud: rax-dfw
|
||||
- debug: var=service_catalog
|
||||
|
||||
- name: Show service catalog
|
||||
debug:
|
||||
var: service_catalog
|
||||
'''
|
||||
|
||||
def main():
|
||||
|
||||
@@ -39,15 +39,17 @@ author: "Monty Taylor (@emonty)"
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Get list of clouds that do not support security groups
|
||||
- os_client_config:
|
||||
- debug: var={{ item }}
|
||||
with_items: "{{ openstack.clouds|rejectattr('secgroup_source', 'none')|list() }}"
|
||||
- name: Get list of clouds that do not support security groups
|
||||
os_client_config:
|
||||
|
||||
# Get the information back just about the mordred cloud
|
||||
- os_client_config:
|
||||
- debug:
|
||||
var: "{{ item }}"
|
||||
with_items: "{{ openstack.clouds | rejectattr('secgroup_source', 'none') | list }}"
|
||||
|
||||
- name: Get the information back just about the mordred cloud
|
||||
os_client_config:
|
||||
clouds:
|
||||
- mordred
|
||||
- mordred
|
||||
'''
|
||||
|
||||
|
||||
|
||||
@@ -42,15 +42,18 @@ extends_documentation_fragment: openstack
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Gather facts about a previously created image named image1
|
||||
- os_image_facts:
|
||||
- name: Gather facts about a previously created image named image1
|
||||
os_image_facts:
|
||||
auth:
|
||||
auth_url: https://your_api_url.com:9000/v2.0
|
||||
auth_url: 'https://your_api_url.com:9000/v2.0'
|
||||
username: user
|
||||
password: password
|
||||
project_name: someproject
|
||||
image: image1
|
||||
- debug: var=openstack
|
||||
|
||||
- name: Show openstack facts
|
||||
debug:
|
||||
var: openstack
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
||||
@@ -46,30 +46,36 @@ extends_documentation_fragment: openstack
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Gather facts about previously created networks
|
||||
- os_networks_facts:
|
||||
- name: Gather facts about previously created networks
|
||||
os_networks_facts:
|
||||
auth:
|
||||
auth_url: https://your_api_url.com:9000/v2.0
|
||||
auth_url: 'https://your_api_url.com:9000/v2.0'
|
||||
username: user
|
||||
password: password
|
||||
project_name: someproject
|
||||
- debug: var=openstack_networks
|
||||
|
||||
# Gather facts about a previously created network by name
|
||||
- os_networks_facts:
|
||||
- name: Show openstack networks
|
||||
debug:
|
||||
var: openstack_networks
|
||||
|
||||
- name: Gather facts about a previously created network by name
|
||||
os_networks_facts:
|
||||
auth:
|
||||
auth_url: https://your_api_url.com:9000/v2.0
|
||||
auth_url: 'https://your_api_url.com:9000/v2.0'
|
||||
username: user
|
||||
password: password
|
||||
project_name: someproject
|
||||
name: network1
|
||||
- debug: var=openstack_networks
|
||||
|
||||
# Gather facts about a previously created network with filter (note: name and
|
||||
filters parameters are Not mutually exclusive)
|
||||
- os_networks_facts:
|
||||
- name: Show openstack networks
|
||||
debug:
|
||||
var: openstack_networks
|
||||
|
||||
- name: Gather facts about a previously created network with filter
|
||||
# Note: name and filters parameters are Not mutually exclusive
|
||||
os_networks_facts:
|
||||
auth:
|
||||
auth_url: https://your_api_url.com:9000/v2.0
|
||||
auth_url: 'https://your_api_url.com:9000/v2.0'
|
||||
username: user
|
||||
password: password
|
||||
project_name: someproject
|
||||
@@ -78,7 +84,10 @@ EXAMPLES = '''
|
||||
subnets:
|
||||
- 057d4bdf-6d4d-4728-bb0f-5ac45a6f7400
|
||||
- 443d4dc0-91d4-4998-b21c-357d10433483
|
||||
- debug: var=openstack_networks
|
||||
|
||||
- name: Show openstack networks
|
||||
debug:
|
||||
var: openstack_networks
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
||||
@@ -88,22 +88,21 @@ requirements: ["shade"]
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Create 'tiny' flavor with 1024MB of RAM, 1 virtual CPU, and 10GB of
|
||||
# local disk, and 10GB of ephemeral.
|
||||
- os_nova_flavor:
|
||||
cloud=mycloud
|
||||
state=present
|
||||
name=tiny
|
||||
ram=1024
|
||||
vcpus=1
|
||||
disk=10
|
||||
ephemeral=10
|
||||
- name: "Create 'tiny' flavor with 1024MB of RAM, 1 virtual CPU, and 10GB of local disk, and 10GB of ephemeral."
|
||||
os_nova_flavor:
|
||||
cloud: mycloud
|
||||
state: present
|
||||
name: tiny
|
||||
ram: 1024
|
||||
vcpus: 1
|
||||
disk: 10
|
||||
ephemeral: 10
|
||||
|
||||
# Delete 'tiny' flavor
|
||||
- os_nova_flavor:
|
||||
cloud=mycloud
|
||||
state=absent
|
||||
name=tiny
|
||||
- name: "Delete 'tiny' flavor"
|
||||
os_nova_flavor:
|
||||
cloud: mycloud
|
||||
state: absent
|
||||
name: tiny
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
||||
@@ -60,11 +60,19 @@ requirements: ["shade"]
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Creates a object named 'fstab' in the 'config' container
|
||||
- os_object: cloud=mordred state=present name=fstab container=config filename=/etc/fstab
|
||||
- name: "Create a object named 'fstab' in the 'config' container"
|
||||
os_object:
|
||||
cloud: mordred
|
||||
state: present
|
||||
name: fstab
|
||||
container: config
|
||||
filename: /etc/fstab
|
||||
|
||||
# Deletes a container called config and all of its contents
|
||||
- os_object: cloud=rax-iad state=absent container=config
|
||||
- name: Delete a container called config and all of its contents
|
||||
os_object:
|
||||
cloud: rax-iad
|
||||
state: absent
|
||||
container: config
|
||||
'''
|
||||
|
||||
|
||||
|
||||
@@ -205,12 +205,11 @@ requirements:
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Creates a new instance and attaches to a network and passes metadata to
|
||||
# the instance
|
||||
- os_server:
|
||||
- name: Create a new instance and attaches to a network and passes metadata to the instance
|
||||
os_server:
|
||||
state: present
|
||||
auth:
|
||||
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
|
||||
auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
|
||||
username: admin
|
||||
password: admin
|
||||
project_name: admin
|
||||
@@ -226,99 +225,98 @@ EXAMPLES = '''
|
||||
hostname: test1
|
||||
group: uge_master
|
||||
|
||||
# Creates a new instance in HP Cloud AE1 region availability zone az2 and
|
||||
# Create a new instance in HP Cloud AE1 region availability zone az2 and
|
||||
# automatically assigns a floating IP
|
||||
- name: launch a compute instance
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
state: present
|
||||
auth:
|
||||
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
|
||||
username: username
|
||||
password: Equality7-2521
|
||||
project_name: username-project1
|
||||
name: vm1
|
||||
region_name: region-b.geo-1
|
||||
availability_zone: az2
|
||||
image: 9302692b-b787-4b52-a3a6-daebb79cb498
|
||||
key_name: test
|
||||
timeout: 200
|
||||
flavor: 101
|
||||
security_groups: default
|
||||
auto_ip: yes
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
state: present
|
||||
auth:
|
||||
auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
|
||||
username: username
|
||||
password: Equality7-2521
|
||||
project_name: username-project1
|
||||
name: vm1
|
||||
region_name: region-b.geo-1
|
||||
availability_zone: az2
|
||||
image: 9302692b-b787-4b52-a3a6-daebb79cb498
|
||||
key_name: test
|
||||
timeout: 200
|
||||
flavor: 101
|
||||
security_groups: default
|
||||
auto_ip: yes
|
||||
|
||||
# Creates a new instance in named cloud mordred availability zone az2
|
||||
# Create a new instance in named cloud mordred availability zone az2
|
||||
# and assigns a pre-known floating IP
|
||||
- name: launch a compute instance
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
state: present
|
||||
cloud: mordred
|
||||
name: vm1
|
||||
availability_zone: az2
|
||||
image: 9302692b-b787-4b52-a3a6-daebb79cb498
|
||||
key_name: test
|
||||
timeout: 200
|
||||
flavor: 101
|
||||
floating_ips:
|
||||
- 12.34.56.79
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
state: present
|
||||
cloud: mordred
|
||||
name: vm1
|
||||
availability_zone: az2
|
||||
image: 9302692b-b787-4b52-a3a6-daebb79cb498
|
||||
key_name: test
|
||||
timeout: 200
|
||||
flavor: 101
|
||||
floating_ips:
|
||||
- 12.34.56.79
|
||||
|
||||
# Creates a new instance with 4G of RAM on Ubuntu Trusty, ignoring
|
||||
# Create a new instance with 4G of RAM on Ubuntu Trusty, ignoring
|
||||
# deprecated images
|
||||
- name: launch a compute instance
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
name: vm1
|
||||
state: present
|
||||
cloud: mordred
|
||||
region_name: region-b.geo-1
|
||||
image: Ubuntu Server 14.04
|
||||
image_exclude: deprecated
|
||||
flavor_ram: 4096
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
name: vm1
|
||||
state: present
|
||||
cloud: mordred
|
||||
region_name: region-b.geo-1
|
||||
image: Ubuntu Server 14.04
|
||||
image_exclude: deprecated
|
||||
flavor_ram: 4096
|
||||
|
||||
# Creates a new instance with 4G of RAM on Ubuntu Trusty on a Performance node
|
||||
# Create a new instance with 4G of RAM on Ubuntu Trusty on a Performance node
|
||||
- name: launch a compute instance
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
name: vm1
|
||||
cloud: rax-dfw
|
||||
state: present
|
||||
image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
|
||||
flavor_ram: 4096
|
||||
flavor_include: Performance
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
name: vm1
|
||||
cloud: rax-dfw
|
||||
state: present
|
||||
image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
|
||||
flavor_ram: 4096
|
||||
flavor_include: Performance
|
||||
|
||||
# Creates a new instance and attaches to multiple network
|
||||
- name: launch a compute instance
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: launch an instance with a string
|
||||
os_server:
|
||||
auth:
|
||||
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
|
||||
username: admin
|
||||
password: admin
|
||||
project_name: admin
|
||||
name: vm1
|
||||
image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
|
||||
key_name: ansible_key
|
||||
timeout: 200
|
||||
flavor: 4
|
||||
nics: "net-id=4cb08b20-62fe-11e5-9d70-feff819cdc9f,net-id=542f0430-62fe-11e5-9d70-feff819cdc9f..."
|
||||
- name: launch an instance with a string
|
||||
os_server:
|
||||
auth:
|
||||
auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
|
||||
username: admin
|
||||
password: admin
|
||||
project_name: admin
|
||||
name: vm1
|
||||
image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
|
||||
key_name: ansible_key
|
||||
timeout: 200
|
||||
flavor: 4
|
||||
nics: "net-id=4cb08b20-62fe-11e5-9d70-feff819cdc9f,net-id=542f0430-62fe-11e5-9d70-feff819cdc9f..."
|
||||
|
||||
# Creates a new instance and attaches to a network and passes metadata to
|
||||
# the instance
|
||||
- os_server:
|
||||
- name: Creates a new instance and attaches to a network and passes metadata to the instance
|
||||
os_server:
|
||||
state: present
|
||||
auth:
|
||||
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
|
||||
auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
|
||||
username: admin
|
||||
password: admin
|
||||
project_name: admin
|
||||
@@ -332,51 +330,51 @@ EXAMPLES = '''
|
||||
- net-name: another_network
|
||||
meta: "hostname=test1,group=uge_master"
|
||||
|
||||
# Creates a new instance and attaches to a specific network
|
||||
- os_server:
|
||||
state: present
|
||||
auth:
|
||||
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
|
||||
username: admin
|
||||
password: admin
|
||||
project_name: admin
|
||||
name: vm1
|
||||
image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
|
||||
key_name: ansible_key
|
||||
timeout: 200
|
||||
flavor: 4
|
||||
network: another_network
|
||||
- name: Creates a new instance and attaches to a specific network
|
||||
os_server:
|
||||
state: present
|
||||
auth:
|
||||
auth_url: 'https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/'
|
||||
username: admin
|
||||
password: admin
|
||||
project_name: admin
|
||||
name: vm1
|
||||
image: 4f905f38-e52a-43d2-b6ec-754a13ffb529
|
||||
key_name: ansible_key
|
||||
timeout: 200
|
||||
flavor: 4
|
||||
network: another_network
|
||||
|
||||
# Creates a new instance with 4G of RAM on a 75G Ubuntu Trusty volume
|
||||
# Create a new instance with 4G of RAM on a 75G Ubuntu Trusty volume
|
||||
- name: launch a compute instance
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
name: vm1
|
||||
state: present
|
||||
cloud: mordred
|
||||
region_name: ams01
|
||||
image: Ubuntu Server 14.04
|
||||
flavor_ram: 4096
|
||||
boot_from_volume: True
|
||||
volume_size: 75
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
name: vm1
|
||||
state: present
|
||||
cloud: mordred
|
||||
region_name: ams01
|
||||
image: Ubuntu Server 14.04
|
||||
flavor_ram: 4096
|
||||
boot_from_volume: True
|
||||
volume_size: 75
|
||||
|
||||
# Creates a new instance with 2 volumes attached
|
||||
- name: launch a compute instance
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
name: vm1
|
||||
state: present
|
||||
cloud: mordred
|
||||
region_name: ams01
|
||||
image: Ubuntu Server 14.04
|
||||
flavor_ram: 4096
|
||||
volumes:
|
||||
- photos
|
||||
- music
|
||||
- name: launch an instance
|
||||
os_server:
|
||||
name: vm1
|
||||
state: present
|
||||
cloud: mordred
|
||||
region_name: ams01
|
||||
image: Ubuntu Server 14.04
|
||||
flavor_ram: 4096
|
||||
volumes:
|
||||
- photos
|
||||
- music
|
||||
'''
|
||||
|
||||
|
||||
|
||||
@@ -46,36 +46,45 @@ extends_documentation_fragment: openstack
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Gather facts about previously created subnets
|
||||
- os_subnets_facts:
|
||||
- name: Gather facts about previously created subnets
|
||||
os_subnets_facts:
|
||||
auth:
|
||||
auth_url: https://your_api_url.com:9000/v2.0
|
||||
auth_url: 'https://your_api_url.com:9000/v2.0'
|
||||
username: user
|
||||
password: password
|
||||
project_name: someproject
|
||||
- debug: var=openstack_subnets
|
||||
|
||||
# Gather facts about a previously created subnet by name
|
||||
- os_subnets_facts:
|
||||
- name: Show openstack subnets
|
||||
debug:
|
||||
var: openstack_subnets
|
||||
|
||||
- name: Gather facts about a previously created subnet by name
|
||||
os_subnets_facts:
|
||||
auth:
|
||||
auth_url: https://your_api_url.com:9000/v2.0
|
||||
auth_url: 'https://your_api_url.com:9000/v2.0'
|
||||
username: user
|
||||
password: password
|
||||
project_name: someproject
|
||||
name: subnet1
|
||||
- debug: var=openstack_subnets
|
||||
name: subnet1
|
||||
|
||||
# Gather facts about a previously created subnet with filter (note: name and
|
||||
filters parameters are Not mutually exclusive)
|
||||
- os_subnets_facts:
|
||||
- name: Show openstack subnets
|
||||
debug:
|
||||
var: openstack_subnets
|
||||
|
||||
- name: Gather facts about a previously created subnet with filter
|
||||
# Note: name and filters parameters are not mutually exclusive
|
||||
os_subnets_facts:
|
||||
auth:
|
||||
auth_url: https://your_api_url.com:9000/v2.0
|
||||
auth_url: 'https://your_api_url.com:9000/v2.0'
|
||||
username: user
|
||||
password: password
|
||||
project_name: someproject
|
||||
filters:
|
||||
tenant_id: 55e2ce24b2a245b09f181bf025724cbe
|
||||
- debug: var=openstack_subnets
|
||||
|
||||
- name: Show openstack subnets
|
||||
debug:
|
||||
var: openstack_subnets
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
||||
Reference in New Issue
Block a user