mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Validate EXAMPLES as YAML
This commit is contained in:
committed by
Toshio Kuratomi
parent
499d3a1b53
commit
7c00346714
@@ -105,14 +105,14 @@ EXAMPLES = '''
|
||||
# It is assumed that their matching environment variables are set.
|
||||
|
||||
# Basic creation example:
|
||||
ec2_vpc:
|
||||
- ec2_vpc:
|
||||
state: present
|
||||
cidr_block: 172.23.0.0/16
|
||||
resource_tags: { "Environment":"Development" }
|
||||
region: us-west-2
|
||||
# Full creation example with subnets and optional availability zones.
|
||||
# The absence or presence of subnets deletes or creates them respectively.
|
||||
ec2_vpc:
|
||||
- ec2_vpc:
|
||||
state: present
|
||||
cidr_block: 172.22.0.0/16
|
||||
resource_tags: { "Environment":"Development" }
|
||||
@@ -143,12 +143,12 @@ EXAMPLES = '''
|
||||
register: vpc
|
||||
|
||||
# Removal of a VPC by id
|
||||
ec2_vpc:
|
||||
- ec2_vpc:
|
||||
state: absent
|
||||
vpc_id: vpc-aaaaaaa
|
||||
region: us-west-2
|
||||
If you have added elements not managed by this module, e.g. instances, NATs, etc then
|
||||
the delete will fail until those dependencies are removed.
|
||||
# If you have added elements not managed by this module, e.g. instances, NATs, etc then
|
||||
# the delete will fail until those dependencies are removed.
|
||||
'''
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ EXAMPLES = '''
|
||||
|
||||
# Facts are published in ansible_facts['cloudformation'][<stack_name>]
|
||||
- debug:
|
||||
msg: '{{ ansible_facts['cloudformation']['my-cloudformation-stack'] }}'
|
||||
msg: "{{ ansible_facts['cloudformation']['my-cloudformation-stack'] }}"
|
||||
|
||||
# Get all stack information about a stack
|
||||
- cloudformation_facts:
|
||||
|
||||
@@ -145,10 +145,10 @@ EXAMPLES = '''
|
||||
|
||||
# Facts are published in ansible_facts['cloudfront'][<distribution_name>]
|
||||
- debug:
|
||||
msg: '{{ ansible_facts['cloudfront']['my-cloudfront-distribution-id'] }}'
|
||||
msg: "{{ ansible_facts['cloudfront']['my-cloudfront-distribution-id'] }}"
|
||||
|
||||
- debug:
|
||||
msg: '{{ ansible_facts['cloudfront']['www.my-website.com'] }}'
|
||||
msg: "{{ ansible_facts['cloudfront']['www.my-website.com'] }}"
|
||||
|
||||
# Get all information about an invalidation for a distribution.
|
||||
- cloudfront_facts:
|
||||
|
||||
@@ -83,7 +83,8 @@ extends_documentation_fragment: aws
|
||||
|
||||
EXAMPLES = """
|
||||
- name: enable cloudtrail
|
||||
local_action: cloudtrail
|
||||
local_action:
|
||||
module: cloudtrail
|
||||
state: enabled
|
||||
name: main
|
||||
s3_bucket_name: ourbucket
|
||||
@@ -91,7 +92,8 @@ EXAMPLES = """
|
||||
region: us-east-1
|
||||
|
||||
- name: enable cloudtrail with different configuration
|
||||
local_action: cloudtrail
|
||||
local_action:
|
||||
module: cloudtrail
|
||||
state: enabled
|
||||
name: main
|
||||
s3_bucket_name: ourbucket2
|
||||
@@ -99,7 +101,8 @@ EXAMPLES = """
|
||||
region: us-east-1
|
||||
|
||||
- name: remove cloudtrail
|
||||
local_action: cloudtrail
|
||||
local_action:
|
||||
module: cloudtrail
|
||||
state: disabled
|
||||
name: main
|
||||
region: us-east-1
|
||||
|
||||
@@ -182,15 +182,15 @@ EXAMPLES = '''
|
||||
|
||||
# Rolling ASG Updates
|
||||
|
||||
Below is an example of how to assign a new launch config to an ASG and terminate old instances.
|
||||
|
||||
All instances in "myasg" that do not have the launch configuration named "my_new_lc" will be terminated in
|
||||
a rolling fashion with instances using the current launch configuration, "my_new_lc".
|
||||
|
||||
This could also be considered a rolling deploy of a pre-baked AMI.
|
||||
|
||||
If this is a newly created group, the instances will not be replaced since all instances
|
||||
will have the current launch configuration.
|
||||
# Below is an example of how to assign a new launch config to an ASG and terminate old instances.
|
||||
#
|
||||
# All instances in "myasg" that do not have the launch configuration named "my_new_lc" will be terminated in
|
||||
# a rolling fashion with instances using the current launch configuration, "my_new_lc".
|
||||
#
|
||||
# This could also be considered a rolling deploy of a pre-baked AMI.
|
||||
#
|
||||
# If this is a newly created group, the instances will not be replaced since all instances
|
||||
# will have the current launch configuration.
|
||||
|
||||
- name: create launch config
|
||||
ec2_lc:
|
||||
@@ -213,8 +213,8 @@ will have the current launch configuration.
|
||||
desired_capacity: 5
|
||||
region: us-east-1
|
||||
|
||||
To only replace a couple of instances instead of all of them, supply a list
|
||||
to "replace_instances":
|
||||
# To only replace a couple of instances instead of all of them, supply a list
|
||||
# to "replace_instances":
|
||||
|
||||
- ec2_asg:
|
||||
name: myasg
|
||||
|
||||
@@ -175,7 +175,7 @@ EXAMPLES = '''
|
||||
|
||||
# Modify the interface to enable the delete_on_terminaton flag
|
||||
- ec2_eni:
|
||||
eni_id: {{ "eni.interface.id" }}
|
||||
eni_id: "{{ eni.interface.id }}"
|
||||
delete_on_termination: true
|
||||
|
||||
'''
|
||||
|
||||
@@ -90,7 +90,7 @@ EXAMPLES = '''
|
||||
hostPort: 80
|
||||
- name: busybox
|
||||
command:
|
||||
- "/bin/sh -c \"while true; do echo '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p>' > top; /bin/date > date ; echo '</div></body></html>' > bottom; cat top date bottom > /usr/local/apache2/htdocs/index.html ; sleep 1; done\""
|
||||
- /bin/sh -c "while true; do echo '<html><head><title>Amazon ECS Sample App</title></head><body><div><h1>Amazon ECS Sample App</h1><h2>Congratulations!</h2><p>Your application is now running on a container in Amazon ECS.</p>' > top; /bin/date > date ; echo '</div></body></html>' > bottom; cat top date bottom > /usr/local/apache2/htdocs/index.html ; sleep 1; done"
|
||||
cpu: 10
|
||||
entryPoint:
|
||||
- sh
|
||||
|
||||
@@ -54,7 +54,7 @@ extends_documentation_fragment:
|
||||
|
||||
EXAMPLES = '''
|
||||
# Add or change a subnet group
|
||||
- elasticache_subnet_group
|
||||
- elasticache_subnet_group:
|
||||
state: present
|
||||
name: norwegian-blue
|
||||
description: My Fancy Ex Parrot Subnet Group
|
||||
|
||||
@@ -276,7 +276,7 @@ EXAMPLES = '''
|
||||
wait: yes
|
||||
|
||||
# Reboot an instance and wait for it to become available again
|
||||
- rds
|
||||
- rds:
|
||||
command: reboot
|
||||
instance_name: database
|
||||
wait: yes
|
||||
|
||||
@@ -67,7 +67,7 @@ EXAMPLES = '''
|
||||
- 'subnet-bbbbb'
|
||||
|
||||
# Remove subnet group
|
||||
redshift_subnet_group: >
|
||||
- redshift_subnet_group:
|
||||
state: absent
|
||||
group_name: redshift-subnet
|
||||
'''
|
||||
|
||||
@@ -163,7 +163,7 @@ EXAMPLES = '''
|
||||
|
||||
- name: Add new instance to host group
|
||||
add_host:
|
||||
hostname: '{{ item['ips'][0].public_ip }}'
|
||||
hostname: "{{ item['ips'][0].public_ip }}"
|
||||
groupname: azure_vms
|
||||
with_items: "{{ azure.deployment.instances }}"
|
||||
|
||||
|
||||
@@ -151,14 +151,14 @@ author:
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Create a network interface with minimal parameters
|
||||
azure_rm_networkinterface:
|
||||
azure_rm_networkinterface:
|
||||
name: nic001
|
||||
resource_group: Testing
|
||||
virtual_network_name: vnet001
|
||||
subnet_name: subnet001
|
||||
|
||||
- name: Create a network interface with private IP address only (no Public IP)
|
||||
azure_rm_networkinterface:
|
||||
- name: Create a network interface with private IP address only (no Public IP)
|
||||
azure_rm_networkinterface:
|
||||
name: nic001
|
||||
resource_group: Testing
|
||||
virtual_network_name: vnet001
|
||||
@@ -166,7 +166,7 @@ EXAMPLES = '''
|
||||
public_ip: no
|
||||
|
||||
- name: Create a network interface for use in a Windows host (opens RDP port) with custom RDP port
|
||||
azure_rm_networkinterface:
|
||||
azure_rm_networkinterface:
|
||||
name: nic002
|
||||
resource_group: Testing
|
||||
virtual_network_name: vnet001
|
||||
@@ -175,7 +175,7 @@ EXAMPLES = '''
|
||||
rdp_port: 3399
|
||||
|
||||
- name: Create a network interface using existing security group and public IP
|
||||
azure_rm_networkinterface:
|
||||
azure_rm_networkinterface:
|
||||
name: nic003
|
||||
resource_group: Testing
|
||||
virtual_network_name: vnet001
|
||||
@@ -184,7 +184,7 @@ EXAMPLES = '''
|
||||
public_ip_address_name: publicip001
|
||||
|
||||
- name: Delete network interface
|
||||
azure_rm_networkinterface:
|
||||
azure_rm_networkinterface:
|
||||
resource_group: Testing
|
||||
name: nic003
|
||||
state: absent
|
||||
|
||||
@@ -76,7 +76,7 @@ EXAMPLES = '''
|
||||
# Note - You must set the CLC_V2_API_USERNAME And CLC_V2_API_PASSWD Environment variables before running these examples
|
||||
|
||||
- name: Deploy package
|
||||
clc_blueprint_package:
|
||||
clc_blueprint_package:
|
||||
server_ids:
|
||||
- UC1TEST-SERVER1
|
||||
- UC1TEST-SERVER2
|
||||
|
||||
@@ -91,7 +91,7 @@ EXAMPLES = '''
|
||||
|
||||
# Ensure account configuration
|
||||
- local_action:
|
||||
module: cs_configuration:
|
||||
module: cs_configuration
|
||||
name: allow.public.user.templates
|
||||
value: false
|
||||
account: acme inc
|
||||
|
||||
@@ -84,7 +84,7 @@ EXAMPLES = '''
|
||||
# register your existing local public key:
|
||||
- cs_sshkeypair:
|
||||
name: linus@example.com
|
||||
public_key: '{{ lookup('file', '~/.ssh/id_rsa.pub') }}'
|
||||
public_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
||||
delegate_to: localhost
|
||||
'''
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ EXAMPLES = '''
|
||||
load_path: my_sinatra.tar
|
||||
|
||||
- name: Build image and with buildargs
|
||||
docker_image:
|
||||
docker_image:
|
||||
path: /path/to/build/dir
|
||||
name: myimage
|
||||
buildargs:
|
||||
|
||||
@@ -236,6 +236,7 @@ EXAMPLES = '''
|
||||
credentials_file: "/path/to/your-key.json"
|
||||
project_id: "your-project-name"
|
||||
|
||||
---
|
||||
# Example Playbook
|
||||
- name: Compute Engine Instance Examples
|
||||
hosts: localhost
|
||||
|
||||
@@ -91,10 +91,10 @@ gcpubsub:
|
||||
mykey2: myvalu2
|
||||
mykey3: myvalue3
|
||||
- message: "this is message 2"
|
||||
attributes:
|
||||
server: prod
|
||||
sla: "99.9999"
|
||||
owner: fred
|
||||
attributes:
|
||||
server: prod
|
||||
sla: "99.9999"
|
||||
owner: fred
|
||||
|
||||
# Subscriptions
|
||||
## Create Subscription (pull)
|
||||
|
||||
@@ -286,7 +286,7 @@ EXAMPLES = '''
|
||||
- proxmox:
|
||||
vmid: 100
|
||||
api_user: root@pam
|
||||
api_passwordL 1q2w3e
|
||||
api_password: 1q2w3e
|
||||
api_host: node1
|
||||
force: yes
|
||||
state: stopped
|
||||
|
||||
@@ -217,8 +217,7 @@ vm:
|
||||
|
||||
EXAMPLES = '''
|
||||
# basic get info from VM
|
||||
action: rhevm
|
||||
args:
|
||||
- rhevm:
|
||||
name: "demo"
|
||||
user: "{{ rhev.admin.name }}"
|
||||
password: "{{ rhev.admin.pass }}"
|
||||
@@ -226,8 +225,7 @@ EXAMPLES = '''
|
||||
state: "info"
|
||||
|
||||
# basic create example from image
|
||||
action: rhevm
|
||||
args:
|
||||
- rhevm:
|
||||
name: "demo"
|
||||
user: "{{ rhev.admin.name }}"
|
||||
password: "{{ rhev.admin.pass }}"
|
||||
@@ -237,8 +235,7 @@ EXAMPLES = '''
|
||||
cluster: "centos"
|
||||
|
||||
# power management
|
||||
action: rhevm
|
||||
args:
|
||||
- rhevm:
|
||||
name: "uptime_server"
|
||||
user: "{{ rhev.admin.name }}"
|
||||
password: "{{ rhev.admin.pass }}"
|
||||
@@ -246,11 +243,10 @@ EXAMPLES = '''
|
||||
cluster: "RH"
|
||||
state: "down"
|
||||
image: "centos7_x64"
|
||||
cluster: "centos
|
||||
cluster: "centos"
|
||||
|
||||
# multi disk, multi nic create example
|
||||
action: rhevm
|
||||
args:
|
||||
- rhevm:
|
||||
name: "server007"
|
||||
user: "{{ rhev.admin.name }}"
|
||||
password: "{{ rhev.admin.pass }}"
|
||||
@@ -290,23 +286,21 @@ EXAMPLES = '''
|
||||
- "hd"
|
||||
|
||||
# add a CD to the disk cd_drive
|
||||
action: rhevm
|
||||
args:
|
||||
name: 'server007'
|
||||
user: "{{ rhev.admin.name }}"
|
||||
password: "{{ rhev.admin.pass }}"
|
||||
state: 'cd'
|
||||
cd_drive: 'rhev-tools-setup.iso'
|
||||
- rhevm:
|
||||
name: 'server007'
|
||||
user: "{{ rhev.admin.name }}"
|
||||
password: "{{ rhev.admin.pass }}"
|
||||
state: 'cd'
|
||||
cd_drive: 'rhev-tools-setup.iso'
|
||||
|
||||
# new host deployment + host network configuration
|
||||
action: rhevm
|
||||
args:
|
||||
name: "ovirt_node007"
|
||||
password: "{{ rhevm.admin.pass }}"
|
||||
type: "host"
|
||||
state: present
|
||||
cluster: "rhevm01"
|
||||
ifaces:
|
||||
- rhevm:
|
||||
name: "ovirt_node007"
|
||||
password: "{{ rhevm.admin.pass }}"
|
||||
type: "host"
|
||||
state: present
|
||||
cluster: "rhevm01"
|
||||
ifaces:
|
||||
- name: em1
|
||||
- name: em2
|
||||
- name: p3p1
|
||||
|
||||
@@ -75,17 +75,18 @@ EXAMPLES = '''
|
||||
state: running
|
||||
|
||||
# /usr/bin/ansible invocations
|
||||
ansible host -m virt -a "name=alpha command=status"
|
||||
ansible host -m virt -a "name=alpha command=get_xml"
|
||||
ansible host -m virt -a "name=alpha command=create uri=lxc:///"
|
||||
# ansible host -m virt -a "name=alpha command=status"
|
||||
# ansible host -m virt -a "name=alpha command=get_xml"
|
||||
# ansible host -m virt -a "name=alpha command=create uri=lxc:///"
|
||||
|
||||
---
|
||||
# a playbook example of defining and launching an LXC guest
|
||||
tasks:
|
||||
- name: define vm
|
||||
virt:
|
||||
name: foo
|
||||
command: define
|
||||
xml: '{{ lookup('template', 'container-template.xml.j2') }}'
|
||||
xml: "{{ lookup('template', 'container-template.xml.j2') }}"
|
||||
uri: 'lxc:///'
|
||||
- name: start vm
|
||||
virt:
|
||||
|
||||
@@ -34,10 +34,11 @@ options: {}
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Gather facts from xenserver
|
||||
xenserver:
|
||||
xenserver:
|
||||
|
||||
- name: Print running VMs
|
||||
debug: msg="{{ item }}"
|
||||
debug:
|
||||
msg: "{{ item }}"
|
||||
with_items: "{{ xs_vms.keys() }}"
|
||||
when: xs_vms[item]['power_state'] == "Running"
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ EXAMPLES = '''
|
||||
var: openstack_domains
|
||||
|
||||
# Gather facts about a previously created domain with filter
|
||||
- os_keystone_domain_facts
|
||||
- os_keystone_domain_facts:
|
||||
cloud: awesomecloud
|
||||
name: demodomain
|
||||
filters:
|
||||
|
||||
@@ -63,16 +63,15 @@ EXAMPLES = '''
|
||||
var: openstack_projects
|
||||
|
||||
# Gather facts about a previously created project in a specific domain
|
||||
- os_project_facts
|
||||
- os_project_facts:
|
||||
cloud: awesomecloud
|
||||
name: demoproject
|
||||
domain: admindomain
|
||||
- debug:
|
||||
var: openstack_projects
|
||||
|
||||
# Gather facts about a previously created project in a specific domain
|
||||
with filter
|
||||
- os_project_facts
|
||||
# Gather facts about a previously created project in a specific domain with filter
|
||||
- os_project_facts:
|
||||
cloud: awesomecloud
|
||||
name: demoproject
|
||||
domain: admindomain
|
||||
|
||||
@@ -298,12 +298,12 @@ EXAMPLES = '''
|
||||
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: 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: Creates a new instance and attaches to a network and passes metadata to the instance
|
||||
os_server:
|
||||
@@ -336,7 +336,7 @@ EXAMPLES = '''
|
||||
key_name: ansible_key
|
||||
timeout: 200
|
||||
flavor: 4
|
||||
network: another_network
|
||||
network: another_network
|
||||
|
||||
# Create a new instance with 4G of RAM on a 75G Ubuntu Trusty volume
|
||||
- name: launch a compute instance
|
||||
|
||||
@@ -86,12 +86,12 @@ EXAMPLES = '''
|
||||
bmc_flavor: m1.medium
|
||||
bmc_image: CentOS
|
||||
key_name: default
|
||||
private_net: {{ private_net_param }}
|
||||
private_net: "{{ private_net_param }}"
|
||||
node_count: 2
|
||||
name: undercloud
|
||||
image: CentOS
|
||||
my_flavor: m1.large
|
||||
external_net: {{ external_net_param }}
|
||||
external_net: "{{ external_net_param }}"
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
||||
@@ -63,16 +63,15 @@ EXAMPLES = '''
|
||||
var: openstack_users
|
||||
|
||||
# Gather facts about a previously created user in a specific domain
|
||||
- os_user_facts
|
||||
- os_user_facts:
|
||||
cloud: awesomecloud
|
||||
name: demouser
|
||||
domain: admindomain
|
||||
- debug:
|
||||
var: openstack_users
|
||||
|
||||
# Gather facts about a previously created user in a specific domain
|
||||
with filter
|
||||
- os_user_facts
|
||||
# Gather facts about a previously created user in a specific domain with filter
|
||||
- os_user_facts:
|
||||
cloud: awesomecloud
|
||||
name: demouser
|
||||
domain: admindomain
|
||||
|
||||
@@ -102,7 +102,7 @@ tasks:
|
||||
# oVirt user's password, and include that yaml file with variable:
|
||||
- include_vars: ovirt_password.yml
|
||||
|
||||
- name: Obtain SSO token with using username/password credentials:
|
||||
- name: Obtain SSO token with using username/password credentials
|
||||
ovirt_auth:
|
||||
url: https://ovirt.example.com/ovirt-engine/api
|
||||
username: admin@internal
|
||||
@@ -116,11 +116,11 @@ tasks:
|
||||
state: absent
|
||||
name: myvm
|
||||
|
||||
always:
|
||||
- name: Always revoke the SSO token
|
||||
ovirt_auth:
|
||||
state: absent
|
||||
ovirt_auth: "{{ ovirt_auth }}"
|
||||
always:
|
||||
- name: Always revoke the SSO token
|
||||
ovirt_auth:
|
||||
state: absent
|
||||
ovirt_auth: "{{ ovirt_auth }}"
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
||||
@@ -73,14 +73,14 @@ EXAMPLES = '''
|
||||
- ovirt_snapshots:
|
||||
vm_name: rhel7
|
||||
description: MySnapshot
|
||||
register: snapshot
|
||||
register: snapshot
|
||||
|
||||
# Create snapshot and save memory:
|
||||
- ovirt_snapshots:
|
||||
vm_name: rhel7
|
||||
description: SnapWithMem
|
||||
use_memory: true
|
||||
register: snapshot
|
||||
register: snapshot
|
||||
|
||||
# Restore snapshot:
|
||||
- ovirt_snapshots:
|
||||
|
||||
@@ -137,12 +137,12 @@ EXAMPLES = '''
|
||||
- name: Creates a new vApp in a VCA instance
|
||||
vca_vapp:
|
||||
vapp_name: tower
|
||||
state=present
|
||||
template_name='Ubuntu Server 12.04 LTS (amd64 20150127)'
|
||||
vdc_name=VDC1
|
||||
instance_id=<your instance id here>
|
||||
username=<your username here>
|
||||
password=<your password here>
|
||||
state: present
|
||||
template_name: 'Ubuntu Server 12.04 LTS (amd64 20150127)'
|
||||
vdc_name: VDC1
|
||||
instance_id: '<your instance id here>'
|
||||
username: '<your username here>'
|
||||
password: '<your password here>'
|
||||
|
||||
'''
|
||||
|
||||
|
||||
@@ -64,14 +64,16 @@ extends_documentation_fragment: vmware.documentation
|
||||
EXAMPLES = '''
|
||||
# Example vmware_cluster command from Ansible Playbooks
|
||||
- name: Create Cluster
|
||||
local_action: >
|
||||
vmware_cluster
|
||||
hostname="{{ ansible_ssh_host }}" username=root password=vmware
|
||||
datacenter_name="datacenter"
|
||||
cluster_name="cluster"
|
||||
enable_ha=True
|
||||
enable_drs=True
|
||||
enable_vsan=True
|
||||
local_action:
|
||||
module: vmware_cluster
|
||||
hostname: "{{ ansible_ssh_host }}"
|
||||
username: root
|
||||
password: vmware
|
||||
datacenter_name: "datacenter"
|
||||
cluster_name: "cluster"
|
||||
enable_ha: True
|
||||
enable_drs: True
|
||||
enable_vsan: True
|
||||
'''
|
||||
|
||||
try:
|
||||
|
||||
@@ -65,10 +65,13 @@ extends_documentation_fragment: vmware.documentation
|
||||
EXAMPLES = '''
|
||||
# Example vmware_datacenter command from Ansible Playbooks
|
||||
- name: Create Datacenter
|
||||
local_action: >
|
||||
vmware_datacenter
|
||||
hostname="{{ ansible_ssh_host }}" username=root password=vmware
|
||||
datacenter_name="datacenter" state=present
|
||||
local_action:
|
||||
module: vmware_datacenter
|
||||
hostname: "{{ ansible_ssh_host }}"
|
||||
username: root
|
||||
password: vmware
|
||||
datacenter_name: "datacenter"
|
||||
state: present
|
||||
'''
|
||||
|
||||
try:
|
||||
|
||||
@@ -65,7 +65,7 @@ extends_documentation_fragment: vmware.documentation
|
||||
|
||||
EXAMPLES = '''
|
||||
- name: Create Management portgroup
|
||||
local_action:
|
||||
local_action:
|
||||
module: vmware_dvs_portgroup
|
||||
hostname: vcenter_ip_or_hostname
|
||||
username: vcenter_username
|
||||
|
||||
@@ -68,7 +68,7 @@ extends_documentation_fragment: vmware.documentation
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
Example from Ansible playbook
|
||||
# Example from Ansible playbook
|
||||
|
||||
- name: Add ESXi Host to VCSA
|
||||
local_action:
|
||||
|
||||
@@ -64,7 +64,7 @@ extends_documentation_fragment: vmware.documentation
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
Example from Ansible playbook
|
||||
# Example from Ansible playbook
|
||||
|
||||
- name: Migrate Management vmk
|
||||
local_action:
|
||||
|
||||
@@ -60,7 +60,7 @@ extends_documentation_fragment: vmware.documentation
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
Example from Ansible playbook
|
||||
# Example from Ansible playbook
|
||||
|
||||
- name: Add Management Network VM Portgroup
|
||||
local_action:
|
||||
|
||||
@@ -45,10 +45,12 @@ extends_documentation_fragment: vmware.documentation
|
||||
EXAMPLES = '''
|
||||
# Example vmware_target_canonical_facts command from Ansible Playbooks
|
||||
- name: Get Canonical name
|
||||
local_action: >
|
||||
vmware_target_canonical_facts
|
||||
hostname="{{ ansible_ssh_host }}" username=root password=vmware
|
||||
target_id=7
|
||||
local_action:
|
||||
module: vmware_target_canonical_facts
|
||||
hostname: "{{ ansible_ssh_host }}"
|
||||
username: root
|
||||
password: vmware
|
||||
target_id: 7
|
||||
'''
|
||||
|
||||
try:
|
||||
|
||||
@@ -51,7 +51,7 @@ extends_documentation_fragment: vmware.documentation
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
Example from Ansible playbook
|
||||
# Example from Ansible playbook
|
||||
|
||||
- name: Perform vMotion of VM
|
||||
local_action:
|
||||
|
||||
@@ -65,7 +65,7 @@ extends_documentation_fragment: vmware.documentation
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
Example from Ansible playbook
|
||||
# Example from Ansible playbook
|
||||
|
||||
- name: Add a VMware vSwitch
|
||||
local_action:
|
||||
|
||||
@@ -153,6 +153,7 @@ requirements:
|
||||
|
||||
|
||||
EXAMPLES = '''
|
||||
---
|
||||
# Create a new VM on an ESX server
|
||||
# Returns changed = False when the VM already exists
|
||||
# Returns changed = True and a adds ansible_facts from the new VM
|
||||
@@ -258,7 +259,7 @@ EXAMPLES = '''
|
||||
guest: newvm001
|
||||
vmware_guest_facts: yes
|
||||
|
||||
|
||||
---
|
||||
# Typical output of a vsphere_facts run on a guest
|
||||
# If vmware tools is not installed, ipadresses with return None
|
||||
|
||||
@@ -277,22 +278,22 @@ EXAMPLES = '''
|
||||
hw_processor_count: 2
|
||||
hw_product_uuid: "ef50bac8-2845-40ff-81d9-675315501dac"
|
||||
|
||||
hw_power_status will be one of the following values:
|
||||
- POWERED ON
|
||||
- POWERED OFF
|
||||
- SUSPENDED
|
||||
- POWERING ON
|
||||
- POWERING OFF
|
||||
- SUSPENDING
|
||||
- RESETTING
|
||||
- BLOCKED ON MSG
|
||||
- REVERTING TO SNAPSHOT
|
||||
- UNKNOWN
|
||||
as seen in the VMPowerState-Class of PySphere: http://git.io/vlwOq
|
||||
# hw_power_status will be one of the following values:
|
||||
# - POWERED ON
|
||||
# - POWERED OFF
|
||||
# - SUSPENDED
|
||||
# - POWERING ON
|
||||
# - POWERING OFF
|
||||
# - SUSPENDING
|
||||
# - RESETTING
|
||||
# - BLOCKED ON MSG
|
||||
# - REVERTING TO SNAPSHOT
|
||||
# - UNKNOWN
|
||||
# as seen in the VMPowerState-Class of PySphere: http://git.io/vlwOq
|
||||
|
||||
---
|
||||
# Remove a vm from vSphere
|
||||
# The VM must be powered_off or you need to use force to force a shutdown
|
||||
|
||||
- vsphere_guest:
|
||||
vcenter_hostname: vcenter.mydomain.local
|
||||
username: myuser
|
||||
|
||||
Reference in New Issue
Block a user