mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Validate EXAMPLES as YAML
This commit is contained in:
parent
499d3a1b53
commit
7c00346714
112 changed files with 441 additions and 381 deletions
|
@ -105,14 +105,14 @@ EXAMPLES = '''
|
||||||
# It is assumed that their matching environment variables are set.
|
# It is assumed that their matching environment variables are set.
|
||||||
|
|
||||||
# Basic creation example:
|
# Basic creation example:
|
||||||
ec2_vpc:
|
- ec2_vpc:
|
||||||
state: present
|
state: present
|
||||||
cidr_block: 172.23.0.0/16
|
cidr_block: 172.23.0.0/16
|
||||||
resource_tags: { "Environment":"Development" }
|
resource_tags: { "Environment":"Development" }
|
||||||
region: us-west-2
|
region: us-west-2
|
||||||
# Full creation example with subnets and optional availability zones.
|
# Full creation example with subnets and optional availability zones.
|
||||||
# The absence or presence of subnets deletes or creates them respectively.
|
# The absence or presence of subnets deletes or creates them respectively.
|
||||||
ec2_vpc:
|
- ec2_vpc:
|
||||||
state: present
|
state: present
|
||||||
cidr_block: 172.22.0.0/16
|
cidr_block: 172.22.0.0/16
|
||||||
resource_tags: { "Environment":"Development" }
|
resource_tags: { "Environment":"Development" }
|
||||||
|
@ -143,12 +143,12 @@ EXAMPLES = '''
|
||||||
register: vpc
|
register: vpc
|
||||||
|
|
||||||
# Removal of a VPC by id
|
# Removal of a VPC by id
|
||||||
ec2_vpc:
|
- ec2_vpc:
|
||||||
state: absent
|
state: absent
|
||||||
vpc_id: vpc-aaaaaaa
|
vpc_id: vpc-aaaaaaa
|
||||||
region: us-west-2
|
region: us-west-2
|
||||||
If you have added elements not managed by this module, e.g. instances, NATs, etc then
|
# 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.
|
# the delete will fail until those dependencies are removed.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Facts are published in ansible_facts['cloudformation'][<stack_name>]
|
# Facts are published in ansible_facts['cloudformation'][<stack_name>]
|
||||||
- debug:
|
- debug:
|
||||||
msg: '{{ ansible_facts['cloudformation']['my-cloudformation-stack'] }}'
|
msg: "{{ ansible_facts['cloudformation']['my-cloudformation-stack'] }}"
|
||||||
|
|
||||||
# Get all stack information about a stack
|
# Get all stack information about a stack
|
||||||
- cloudformation_facts:
|
- cloudformation_facts:
|
||||||
|
|
|
@ -145,10 +145,10 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Facts are published in ansible_facts['cloudfront'][<distribution_name>]
|
# Facts are published in ansible_facts['cloudfront'][<distribution_name>]
|
||||||
- debug:
|
- debug:
|
||||||
msg: '{{ ansible_facts['cloudfront']['my-cloudfront-distribution-id'] }}'
|
msg: "{{ ansible_facts['cloudfront']['my-cloudfront-distribution-id'] }}"
|
||||||
|
|
||||||
- debug:
|
- 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.
|
# Get all information about an invalidation for a distribution.
|
||||||
- cloudfront_facts:
|
- cloudfront_facts:
|
||||||
|
|
|
@ -83,7 +83,8 @@ extends_documentation_fragment: aws
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
- name: enable cloudtrail
|
- name: enable cloudtrail
|
||||||
local_action: cloudtrail
|
local_action:
|
||||||
|
module: cloudtrail
|
||||||
state: enabled
|
state: enabled
|
||||||
name: main
|
name: main
|
||||||
s3_bucket_name: ourbucket
|
s3_bucket_name: ourbucket
|
||||||
|
@ -91,7 +92,8 @@ EXAMPLES = """
|
||||||
region: us-east-1
|
region: us-east-1
|
||||||
|
|
||||||
- name: enable cloudtrail with different configuration
|
- name: enable cloudtrail with different configuration
|
||||||
local_action: cloudtrail
|
local_action:
|
||||||
|
module: cloudtrail
|
||||||
state: enabled
|
state: enabled
|
||||||
name: main
|
name: main
|
||||||
s3_bucket_name: ourbucket2
|
s3_bucket_name: ourbucket2
|
||||||
|
@ -99,7 +101,8 @@ EXAMPLES = """
|
||||||
region: us-east-1
|
region: us-east-1
|
||||||
|
|
||||||
- name: remove cloudtrail
|
- name: remove cloudtrail
|
||||||
local_action: cloudtrail
|
local_action:
|
||||||
|
module: cloudtrail
|
||||||
state: disabled
|
state: disabled
|
||||||
name: main
|
name: main
|
||||||
region: us-east-1
|
region: us-east-1
|
||||||
|
|
|
@ -182,15 +182,15 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Rolling ASG Updates
|
# Rolling ASG Updates
|
||||||
|
|
||||||
Below is an example of how to assign a new launch config to an ASG and terminate old instances.
|
# 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
|
# 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".
|
# 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.
|
# 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
|
# If this is a newly created group, the instances will not be replaced since all instances
|
||||||
will have the current launch configuration.
|
# will have the current launch configuration.
|
||||||
|
|
||||||
- name: create launch config
|
- name: create launch config
|
||||||
ec2_lc:
|
ec2_lc:
|
||||||
|
@ -213,8 +213,8 @@ will have the current launch configuration.
|
||||||
desired_capacity: 5
|
desired_capacity: 5
|
||||||
region: us-east-1
|
region: us-east-1
|
||||||
|
|
||||||
To only replace a couple of instances instead of all of them, supply a list
|
# To only replace a couple of instances instead of all of them, supply a list
|
||||||
to "replace_instances":
|
# to "replace_instances":
|
||||||
|
|
||||||
- ec2_asg:
|
- ec2_asg:
|
||||||
name: myasg
|
name: myasg
|
||||||
|
|
|
@ -175,7 +175,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Modify the interface to enable the delete_on_terminaton flag
|
# Modify the interface to enable the delete_on_terminaton flag
|
||||||
- ec2_eni:
|
- ec2_eni:
|
||||||
eni_id: {{ "eni.interface.id" }}
|
eni_id: "{{ eni.interface.id }}"
|
||||||
delete_on_termination: true
|
delete_on_termination: true
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -90,7 +90,7 @@ EXAMPLES = '''
|
||||||
hostPort: 80
|
hostPort: 80
|
||||||
- name: busybox
|
- name: busybox
|
||||||
command:
|
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
|
cpu: 10
|
||||||
entryPoint:
|
entryPoint:
|
||||||
- sh
|
- sh
|
||||||
|
|
|
@ -54,7 +54,7 @@ extends_documentation_fragment:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Add or change a subnet group
|
# Add or change a subnet group
|
||||||
- elasticache_subnet_group
|
- elasticache_subnet_group:
|
||||||
state: present
|
state: present
|
||||||
name: norwegian-blue
|
name: norwegian-blue
|
||||||
description: My Fancy Ex Parrot Subnet Group
|
description: My Fancy Ex Parrot Subnet Group
|
||||||
|
|
|
@ -276,7 +276,7 @@ EXAMPLES = '''
|
||||||
wait: yes
|
wait: yes
|
||||||
|
|
||||||
# Reboot an instance and wait for it to become available again
|
# Reboot an instance and wait for it to become available again
|
||||||
- rds
|
- rds:
|
||||||
command: reboot
|
command: reboot
|
||||||
instance_name: database
|
instance_name: database
|
||||||
wait: yes
|
wait: yes
|
||||||
|
|
|
@ -67,7 +67,7 @@ EXAMPLES = '''
|
||||||
- 'subnet-bbbbb'
|
- 'subnet-bbbbb'
|
||||||
|
|
||||||
# Remove subnet group
|
# Remove subnet group
|
||||||
redshift_subnet_group: >
|
- redshift_subnet_group:
|
||||||
state: absent
|
state: absent
|
||||||
group_name: redshift-subnet
|
group_name: redshift-subnet
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -163,7 +163,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
- name: Add new instance to host group
|
- name: Add new instance to host group
|
||||||
add_host:
|
add_host:
|
||||||
hostname: '{{ item['ips'][0].public_ip }}'
|
hostname: "{{ item['ips'][0].public_ip }}"
|
||||||
groupname: azure_vms
|
groupname: azure_vms
|
||||||
with_items: "{{ azure.deployment.instances }}"
|
with_items: "{{ azure.deployment.instances }}"
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Ensure account configuration
|
# Ensure account configuration
|
||||||
- local_action:
|
- local_action:
|
||||||
module: cs_configuration:
|
module: cs_configuration
|
||||||
name: allow.public.user.templates
|
name: allow.public.user.templates
|
||||||
value: false
|
value: false
|
||||||
account: acme inc
|
account: acme inc
|
||||||
|
|
|
@ -84,7 +84,7 @@ EXAMPLES = '''
|
||||||
# register your existing local public key:
|
# register your existing local public key:
|
||||||
- cs_sshkeypair:
|
- cs_sshkeypair:
|
||||||
name: linus@example.com
|
name: linus@example.com
|
||||||
public_key: '{{ lookup('file', '~/.ssh/id_rsa.pub') }}'
|
public_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -236,6 +236,7 @@ EXAMPLES = '''
|
||||||
credentials_file: "/path/to/your-key.json"
|
credentials_file: "/path/to/your-key.json"
|
||||||
project_id: "your-project-name"
|
project_id: "your-project-name"
|
||||||
|
|
||||||
|
---
|
||||||
# Example Playbook
|
# Example Playbook
|
||||||
- name: Compute Engine Instance Examples
|
- name: Compute Engine Instance Examples
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
|
|
|
@ -286,7 +286,7 @@ EXAMPLES = '''
|
||||||
- proxmox:
|
- proxmox:
|
||||||
vmid: 100
|
vmid: 100
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_passwordL 1q2w3e
|
api_password: 1q2w3e
|
||||||
api_host: node1
|
api_host: node1
|
||||||
force: yes
|
force: yes
|
||||||
state: stopped
|
state: stopped
|
||||||
|
|
|
@ -217,8 +217,7 @@ vm:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# basic get info from VM
|
# basic get info from VM
|
||||||
action: rhevm
|
- rhevm:
|
||||||
args:
|
|
||||||
name: "demo"
|
name: "demo"
|
||||||
user: "{{ rhev.admin.name }}"
|
user: "{{ rhev.admin.name }}"
|
||||||
password: "{{ rhev.admin.pass }}"
|
password: "{{ rhev.admin.pass }}"
|
||||||
|
@ -226,8 +225,7 @@ EXAMPLES = '''
|
||||||
state: "info"
|
state: "info"
|
||||||
|
|
||||||
# basic create example from image
|
# basic create example from image
|
||||||
action: rhevm
|
- rhevm:
|
||||||
args:
|
|
||||||
name: "demo"
|
name: "demo"
|
||||||
user: "{{ rhev.admin.name }}"
|
user: "{{ rhev.admin.name }}"
|
||||||
password: "{{ rhev.admin.pass }}"
|
password: "{{ rhev.admin.pass }}"
|
||||||
|
@ -237,8 +235,7 @@ EXAMPLES = '''
|
||||||
cluster: "centos"
|
cluster: "centos"
|
||||||
|
|
||||||
# power management
|
# power management
|
||||||
action: rhevm
|
- rhevm:
|
||||||
args:
|
|
||||||
name: "uptime_server"
|
name: "uptime_server"
|
||||||
user: "{{ rhev.admin.name }}"
|
user: "{{ rhev.admin.name }}"
|
||||||
password: "{{ rhev.admin.pass }}"
|
password: "{{ rhev.admin.pass }}"
|
||||||
|
@ -246,11 +243,10 @@ EXAMPLES = '''
|
||||||
cluster: "RH"
|
cluster: "RH"
|
||||||
state: "down"
|
state: "down"
|
||||||
image: "centos7_x64"
|
image: "centos7_x64"
|
||||||
cluster: "centos
|
cluster: "centos"
|
||||||
|
|
||||||
# multi disk, multi nic create example
|
# multi disk, multi nic create example
|
||||||
action: rhevm
|
- rhevm:
|
||||||
args:
|
|
||||||
name: "server007"
|
name: "server007"
|
||||||
user: "{{ rhev.admin.name }}"
|
user: "{{ rhev.admin.name }}"
|
||||||
password: "{{ rhev.admin.pass }}"
|
password: "{{ rhev.admin.pass }}"
|
||||||
|
@ -290,8 +286,7 @@ EXAMPLES = '''
|
||||||
- "hd"
|
- "hd"
|
||||||
|
|
||||||
# add a CD to the disk cd_drive
|
# add a CD to the disk cd_drive
|
||||||
action: rhevm
|
- rhevm:
|
||||||
args:
|
|
||||||
name: 'server007'
|
name: 'server007'
|
||||||
user: "{{ rhev.admin.name }}"
|
user: "{{ rhev.admin.name }}"
|
||||||
password: "{{ rhev.admin.pass }}"
|
password: "{{ rhev.admin.pass }}"
|
||||||
|
@ -299,8 +294,7 @@ EXAMPLES = '''
|
||||||
cd_drive: 'rhev-tools-setup.iso'
|
cd_drive: 'rhev-tools-setup.iso'
|
||||||
|
|
||||||
# new host deployment + host network configuration
|
# new host deployment + host network configuration
|
||||||
action: rhevm
|
- rhevm:
|
||||||
args:
|
|
||||||
name: "ovirt_node007"
|
name: "ovirt_node007"
|
||||||
password: "{{ rhevm.admin.pass }}"
|
password: "{{ rhevm.admin.pass }}"
|
||||||
type: "host"
|
type: "host"
|
||||||
|
|
|
@ -75,17 +75,18 @@ EXAMPLES = '''
|
||||||
state: running
|
state: running
|
||||||
|
|
||||||
# /usr/bin/ansible invocations
|
# /usr/bin/ansible invocations
|
||||||
ansible host -m virt -a "name=alpha command=status"
|
# 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=get_xml"
|
||||||
ansible host -m virt -a "name=alpha command=create uri=lxc:///"
|
# ansible host -m virt -a "name=alpha command=create uri=lxc:///"
|
||||||
|
|
||||||
|
---
|
||||||
# a playbook example of defining and launching an LXC guest
|
# a playbook example of defining and launching an LXC guest
|
||||||
tasks:
|
tasks:
|
||||||
- name: define vm
|
- name: define vm
|
||||||
virt:
|
virt:
|
||||||
name: foo
|
name: foo
|
||||||
command: define
|
command: define
|
||||||
xml: '{{ lookup('template', 'container-template.xml.j2') }}'
|
xml: "{{ lookup('template', 'container-template.xml.j2') }}"
|
||||||
uri: 'lxc:///'
|
uri: 'lxc:///'
|
||||||
- name: start vm
|
- name: start vm
|
||||||
virt:
|
virt:
|
||||||
|
|
|
@ -37,7 +37,8 @@ EXAMPLES = '''
|
||||||
xenserver:
|
xenserver:
|
||||||
|
|
||||||
- name: Print running VMs
|
- name: Print running VMs
|
||||||
debug: msg="{{ item }}"
|
debug:
|
||||||
|
msg: "{{ item }}"
|
||||||
with_items: "{{ xs_vms.keys() }}"
|
with_items: "{{ xs_vms.keys() }}"
|
||||||
when: xs_vms[item]['power_state'] == "Running"
|
when: xs_vms[item]['power_state'] == "Running"
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ EXAMPLES = '''
|
||||||
var: openstack_domains
|
var: openstack_domains
|
||||||
|
|
||||||
# Gather facts about a previously created domain with filter
|
# Gather facts about a previously created domain with filter
|
||||||
- os_keystone_domain_facts
|
- os_keystone_domain_facts:
|
||||||
cloud: awesomecloud
|
cloud: awesomecloud
|
||||||
name: demodomain
|
name: demodomain
|
||||||
filters:
|
filters:
|
||||||
|
|
|
@ -63,16 +63,15 @@ EXAMPLES = '''
|
||||||
var: openstack_projects
|
var: openstack_projects
|
||||||
|
|
||||||
# Gather facts about a previously created project in a specific domain
|
# Gather facts about a previously created project in a specific domain
|
||||||
- os_project_facts
|
- os_project_facts:
|
||||||
cloud: awesomecloud
|
cloud: awesomecloud
|
||||||
name: demoproject
|
name: demoproject
|
||||||
domain: admindomain
|
domain: admindomain
|
||||||
- debug:
|
- debug:
|
||||||
var: openstack_projects
|
var: openstack_projects
|
||||||
|
|
||||||
# Gather facts about a previously created project in a specific domain
|
# Gather facts about a previously created project in a specific domain with filter
|
||||||
with filter
|
- os_project_facts:
|
||||||
- os_project_facts
|
|
||||||
cloud: awesomecloud
|
cloud: awesomecloud
|
||||||
name: demoproject
|
name: demoproject
|
||||||
domain: admindomain
|
domain: admindomain
|
||||||
|
|
|
@ -86,12 +86,12 @@ EXAMPLES = '''
|
||||||
bmc_flavor: m1.medium
|
bmc_flavor: m1.medium
|
||||||
bmc_image: CentOS
|
bmc_image: CentOS
|
||||||
key_name: default
|
key_name: default
|
||||||
private_net: {{ private_net_param }}
|
private_net: "{{ private_net_param }}"
|
||||||
node_count: 2
|
node_count: 2
|
||||||
name: undercloud
|
name: undercloud
|
||||||
image: CentOS
|
image: CentOS
|
||||||
my_flavor: m1.large
|
my_flavor: m1.large
|
||||||
external_net: {{ external_net_param }}
|
external_net: "{{ external_net_param }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
|
@ -63,16 +63,15 @@ EXAMPLES = '''
|
||||||
var: openstack_users
|
var: openstack_users
|
||||||
|
|
||||||
# Gather facts about a previously created user in a specific domain
|
# Gather facts about a previously created user in a specific domain
|
||||||
- os_user_facts
|
- os_user_facts:
|
||||||
cloud: awesomecloud
|
cloud: awesomecloud
|
||||||
name: demouser
|
name: demouser
|
||||||
domain: admindomain
|
domain: admindomain
|
||||||
- debug:
|
- debug:
|
||||||
var: openstack_users
|
var: openstack_users
|
||||||
|
|
||||||
# Gather facts about a previously created user in a specific domain
|
# Gather facts about a previously created user in a specific domain with filter
|
||||||
with filter
|
- os_user_facts:
|
||||||
- os_user_facts
|
|
||||||
cloud: awesomecloud
|
cloud: awesomecloud
|
||||||
name: demouser
|
name: demouser
|
||||||
domain: admindomain
|
domain: admindomain
|
||||||
|
|
|
@ -102,7 +102,7 @@ tasks:
|
||||||
# oVirt user's password, and include that yaml file with variable:
|
# oVirt user's password, and include that yaml file with variable:
|
||||||
- include_vars: ovirt_password.yml
|
- 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:
|
ovirt_auth:
|
||||||
url: https://ovirt.example.com/ovirt-engine/api
|
url: https://ovirt.example.com/ovirt-engine/api
|
||||||
username: admin@internal
|
username: admin@internal
|
||||||
|
|
|
@ -73,14 +73,14 @@ EXAMPLES = '''
|
||||||
- ovirt_snapshots:
|
- ovirt_snapshots:
|
||||||
vm_name: rhel7
|
vm_name: rhel7
|
||||||
description: MySnapshot
|
description: MySnapshot
|
||||||
register: snapshot
|
register: snapshot
|
||||||
|
|
||||||
# Create snapshot and save memory:
|
# Create snapshot and save memory:
|
||||||
- ovirt_snapshots:
|
- ovirt_snapshots:
|
||||||
vm_name: rhel7
|
vm_name: rhel7
|
||||||
description: SnapWithMem
|
description: SnapWithMem
|
||||||
use_memory: true
|
use_memory: true
|
||||||
register: snapshot
|
register: snapshot
|
||||||
|
|
||||||
# Restore snapshot:
|
# Restore snapshot:
|
||||||
- ovirt_snapshots:
|
- ovirt_snapshots:
|
||||||
|
|
|
@ -137,12 +137,12 @@ EXAMPLES = '''
|
||||||
- name: Creates a new vApp in a VCA instance
|
- name: Creates a new vApp in a VCA instance
|
||||||
vca_vapp:
|
vca_vapp:
|
||||||
vapp_name: tower
|
vapp_name: tower
|
||||||
state=present
|
state: present
|
||||||
template_name='Ubuntu Server 12.04 LTS (amd64 20150127)'
|
template_name: 'Ubuntu Server 12.04 LTS (amd64 20150127)'
|
||||||
vdc_name=VDC1
|
vdc_name: VDC1
|
||||||
instance_id=<your instance id here>
|
instance_id: '<your instance id here>'
|
||||||
username=<your username here>
|
username: '<your username here>'
|
||||||
password=<your password here>
|
password: '<your password here>'
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
@ -64,14 +64,16 @@ extends_documentation_fragment: vmware.documentation
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Example vmware_cluster command from Ansible Playbooks
|
# Example vmware_cluster command from Ansible Playbooks
|
||||||
- name: Create Cluster
|
- name: Create Cluster
|
||||||
local_action: >
|
local_action:
|
||||||
vmware_cluster
|
module: vmware_cluster
|
||||||
hostname="{{ ansible_ssh_host }}" username=root password=vmware
|
hostname: "{{ ansible_ssh_host }}"
|
||||||
datacenter_name="datacenter"
|
username: root
|
||||||
cluster_name="cluster"
|
password: vmware
|
||||||
enable_ha=True
|
datacenter_name: "datacenter"
|
||||||
enable_drs=True
|
cluster_name: "cluster"
|
||||||
enable_vsan=True
|
enable_ha: True
|
||||||
|
enable_drs: True
|
||||||
|
enable_vsan: True
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -65,10 +65,13 @@ extends_documentation_fragment: vmware.documentation
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Example vmware_datacenter command from Ansible Playbooks
|
# Example vmware_datacenter command from Ansible Playbooks
|
||||||
- name: Create Datacenter
|
- name: Create Datacenter
|
||||||
local_action: >
|
local_action:
|
||||||
vmware_datacenter
|
module: vmware_datacenter
|
||||||
hostname="{{ ansible_ssh_host }}" username=root password=vmware
|
hostname: "{{ ansible_ssh_host }}"
|
||||||
datacenter_name="datacenter" state=present
|
username: root
|
||||||
|
password: vmware
|
||||||
|
datacenter_name: "datacenter"
|
||||||
|
state: present
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -68,7 +68,7 @@ extends_documentation_fragment: vmware.documentation
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
Example from Ansible playbook
|
# Example from Ansible playbook
|
||||||
|
|
||||||
- name: Add ESXi Host to VCSA
|
- name: Add ESXi Host to VCSA
|
||||||
local_action:
|
local_action:
|
||||||
|
|
|
@ -64,7 +64,7 @@ extends_documentation_fragment: vmware.documentation
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
Example from Ansible playbook
|
# Example from Ansible playbook
|
||||||
|
|
||||||
- name: Migrate Management vmk
|
- name: Migrate Management vmk
|
||||||
local_action:
|
local_action:
|
||||||
|
|
|
@ -60,7 +60,7 @@ extends_documentation_fragment: vmware.documentation
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
Example from Ansible playbook
|
# Example from Ansible playbook
|
||||||
|
|
||||||
- name: Add Management Network VM Portgroup
|
- name: Add Management Network VM Portgroup
|
||||||
local_action:
|
local_action:
|
||||||
|
|
|
@ -45,10 +45,12 @@ extends_documentation_fragment: vmware.documentation
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
# Example vmware_target_canonical_facts command from Ansible Playbooks
|
# Example vmware_target_canonical_facts command from Ansible Playbooks
|
||||||
- name: Get Canonical name
|
- name: Get Canonical name
|
||||||
local_action: >
|
local_action:
|
||||||
vmware_target_canonical_facts
|
module: vmware_target_canonical_facts
|
||||||
hostname="{{ ansible_ssh_host }}" username=root password=vmware
|
hostname: "{{ ansible_ssh_host }}"
|
||||||
target_id=7
|
username: root
|
||||||
|
password: vmware
|
||||||
|
target_id: 7
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -51,7 +51,7 @@ extends_documentation_fragment: vmware.documentation
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
Example from Ansible playbook
|
# Example from Ansible playbook
|
||||||
|
|
||||||
- name: Perform vMotion of VM
|
- name: Perform vMotion of VM
|
||||||
local_action:
|
local_action:
|
||||||
|
|
|
@ -65,7 +65,7 @@ extends_documentation_fragment: vmware.documentation
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
Example from Ansible playbook
|
# Example from Ansible playbook
|
||||||
|
|
||||||
- name: Add a VMware vSwitch
|
- name: Add a VMware vSwitch
|
||||||
local_action:
|
local_action:
|
||||||
|
|
|
@ -153,6 +153,7 @@ requirements:
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
---
|
||||||
# Create a new VM on an ESX server
|
# Create a new VM on an ESX server
|
||||||
# Returns changed = False when the VM already exists
|
# Returns changed = False when the VM already exists
|
||||||
# Returns changed = True and a adds ansible_facts from the new VM
|
# Returns changed = True and a adds ansible_facts from the new VM
|
||||||
|
@ -258,7 +259,7 @@ EXAMPLES = '''
|
||||||
guest: newvm001
|
guest: newvm001
|
||||||
vmware_guest_facts: yes
|
vmware_guest_facts: yes
|
||||||
|
|
||||||
|
---
|
||||||
# Typical output of a vsphere_facts run on a guest
|
# Typical output of a vsphere_facts run on a guest
|
||||||
# If vmware tools is not installed, ipadresses with return None
|
# If vmware tools is not installed, ipadresses with return None
|
||||||
|
|
||||||
|
@ -277,22 +278,22 @@ EXAMPLES = '''
|
||||||
hw_processor_count: 2
|
hw_processor_count: 2
|
||||||
hw_product_uuid: "ef50bac8-2845-40ff-81d9-675315501dac"
|
hw_product_uuid: "ef50bac8-2845-40ff-81d9-675315501dac"
|
||||||
|
|
||||||
hw_power_status will be one of the following values:
|
# hw_power_status will be one of the following values:
|
||||||
- POWERED ON
|
# - POWERED ON
|
||||||
- POWERED OFF
|
# - POWERED OFF
|
||||||
- SUSPENDED
|
# - SUSPENDED
|
||||||
- POWERING ON
|
# - POWERING ON
|
||||||
- POWERING OFF
|
# - POWERING OFF
|
||||||
- SUSPENDING
|
# - SUSPENDING
|
||||||
- RESETTING
|
# - RESETTING
|
||||||
- BLOCKED ON MSG
|
# - BLOCKED ON MSG
|
||||||
- REVERTING TO SNAPSHOT
|
# - REVERTING TO SNAPSHOT
|
||||||
- UNKNOWN
|
# - UNKNOWN
|
||||||
as seen in the VMPowerState-Class of PySphere: http://git.io/vlwOq
|
# as seen in the VMPowerState-Class of PySphere: http://git.io/vlwOq
|
||||||
|
|
||||||
|
---
|
||||||
# Remove a vm from vSphere
|
# Remove a vm from vSphere
|
||||||
# The VM must be powered_off or you need to use force to force a shutdown
|
# The VM must be powered_off or you need to use force to force a shutdown
|
||||||
|
|
||||||
- vsphere_guest:
|
- vsphere_guest:
|
||||||
vcenter_hostname: vcenter.mydomain.local
|
vcenter_hostname: vcenter.mydomain.local
|
||||||
username: myuser
|
username: myuser
|
||||||
|
|
|
@ -76,5 +76,5 @@ EXAMPLES = '''
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
|
|
||||||
- name: safely use templated variables. Always use quote filter to avoid injection issues.
|
- name: safely use templated variables. Always use quote filter to avoid injection issues.
|
||||||
raw: {{package_mgr|quote}} {{pkg_flags|quote}} install {{python_simplejson|quote}}
|
raw: "{{package_mgr|quote}} {{pkg_flags|quote}} install {{python_simplejson|quote}}"
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -183,7 +183,7 @@ EXAMPLES = """
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
# Example privileges string format
|
# Example privileges string format
|
||||||
mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL
|
# mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL
|
||||||
|
|
||||||
# Example using login_unix_socket to connect to server
|
# Example using login_unix_socket to connect to server
|
||||||
- mysql_user:
|
- mysql_user:
|
||||||
|
@ -200,10 +200,9 @@ mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL
|
||||||
sql_log_bin: no
|
sql_log_bin: no
|
||||||
|
|
||||||
# Example .my.cnf file for setting the root password
|
# Example .my.cnf file for setting the root password
|
||||||
|
# [client]
|
||||||
[client]
|
# user=root
|
||||||
user=root
|
# password=n<_665{vS43y
|
||||||
password=n<_665{vS43y
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
|
|
|
@ -189,7 +189,7 @@ EXAMPLES = '''
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
# Example privileges string format
|
# Example privileges string format
|
||||||
INSERT,UPDATE/table:SELECT/anothertable:ALL
|
# INSERT,UPDATE/table:SELECT/anothertable:ALL
|
||||||
|
|
||||||
# Remove an existing user's password
|
# Remove an existing user's password
|
||||||
- postgresql_user:
|
- postgresql_user:
|
||||||
|
|
|
@ -244,7 +244,7 @@ EXAMPLES = '''
|
||||||
links: yes
|
links: yes
|
||||||
|
|
||||||
# Synchronization of two paths both on the control machine
|
# Synchronization of two paths both on the control machine
|
||||||
- synchronize
|
- synchronize:
|
||||||
src: some/relative/path
|
src: some/relative/path
|
||||||
dest: /some/absolute/path
|
dest: /some/absolute/path
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
@ -282,9 +282,9 @@ EXAMPLES = '''
|
||||||
rsync_path: "su -c rsync"
|
rsync_path: "su -c rsync"
|
||||||
|
|
||||||
# Example .rsync-filter file in the source directory
|
# Example .rsync-filter file in the source directory
|
||||||
- var # exclude any path whose last part is 'var'
|
# - var # exclude any path whose last part is 'var'
|
||||||
- /var # exclude any path starting with 'var' starting at the source directory
|
# - /var # exclude any path starting with 'var' starting at the source directory
|
||||||
+ /var/conf # include /var/conf even though it was previously excluded
|
# + /var/conf # include /var/conf even though it was previously excluded
|
||||||
|
|
||||||
# Synchronize passing in extra rsync options
|
# Synchronize passing in extra rsync options
|
||||||
- synchronize:
|
- synchronize:
|
||||||
|
|
|
@ -88,7 +88,7 @@ EXAMPLES = '''
|
||||||
version: '1.3'
|
version: '1.3'
|
||||||
token: '{{ bigpanda_token }}'
|
token: '{{ bigpanda_token }}'
|
||||||
state: started
|
state: started
|
||||||
...
|
|
||||||
- bigpanda:
|
- bigpanda:
|
||||||
component: myapp
|
component: myapp
|
||||||
version: '1.3'
|
version: '1.3'
|
||||||
|
@ -104,7 +104,7 @@ EXAMPLES = '''
|
||||||
state: started
|
state: started
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: deployment
|
register: deployment
|
||||||
...
|
|
||||||
- bigpanda:
|
- bigpanda:
|
||||||
component: '{{ deployment.component }}'
|
component: '{{ deployment.component }}'
|
||||||
version: '{{ deployment.version }}'
|
version: '{{ deployment.version }}'
|
||||||
|
|
|
@ -122,7 +122,7 @@ datadog_monitor:
|
||||||
type: "metric alert"
|
type: "metric alert"
|
||||||
name: "Test monitor"
|
name: "Test monitor"
|
||||||
state: "present"
|
state: "present"
|
||||||
query: "datadog.agent.up".over("host:host1").last(2).count_by_status()"
|
query: "datadog.agent.up.over('host:host1').last(2).count_by_status()"
|
||||||
message: "Host [[host.name]] with IP [[host.ip]] is failing to report to datadog."
|
message: "Host [[host.name]] with IP [[host.ip]] is failing to report to datadog."
|
||||||
api_key: "9775a026f1ca7d1c6c5af9d94d9595a4"
|
api_key: "9775a026f1ca7d1c6c5af9d94d9595a4"
|
||||||
app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
|
app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
|
||||||
|
|
|
@ -230,7 +230,7 @@ EXAMPLES = '''
|
||||||
tasks:
|
tasks:
|
||||||
- name: Create a host group
|
- name: Create a host group
|
||||||
# All tasks except for target=collector should use delegate_to: localhost
|
# All tasks except for target=collector should use delegate_to: localhost
|
||||||
logicmonitor
|
logicmonitor:
|
||||||
target: hostgroup
|
target: hostgroup
|
||||||
action: add
|
action: add
|
||||||
fullpath: /servers/development
|
fullpath: /servers/development
|
||||||
|
|
|
@ -102,6 +102,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -111,6 +112,7 @@ vars:
|
||||||
authorize: yes
|
authorize: yes
|
||||||
auth_pass: cisco
|
auth_pass: cisco
|
||||||
|
|
||||||
|
---
|
||||||
- asa_acl:
|
- asa_acl:
|
||||||
lines:
|
lines:
|
||||||
- access-list ACL-ANSIBLE extended permit tcp any any eq 82
|
- access-list ACL-ANSIBLE extended permit tcp any any eq 82
|
||||||
|
|
|
@ -84,6 +84,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -93,7 +94,7 @@ vars:
|
||||||
auth_pass: cisco
|
auth_pass: cisco
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- asa_command:
|
- asa_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
|
|
|
@ -172,6 +172,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -181,6 +182,7 @@ vars:
|
||||||
auth_pass: cisco
|
auth_pass: cisco
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- asa_config:
|
- asa_config:
|
||||||
lines:
|
lines:
|
||||||
- network-object host 10.80.30.18
|
- network-object host 10.80.30.18
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Ansible module to manage Big Monitoring Fabric service chains
|
# Ansible module to manage Big Monitoring Fabric service chains
|
||||||
# (c) 2016, Ted Elhourani <ted@bigswitch.com>
|
# (c) 2016, Ted Elhourani <ted@bigswitch.com>,
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
#
|
#
|
||||||
|
|
|
@ -84,6 +84,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -91,6 +92,7 @@ vars:
|
||||||
password: admin
|
password: admin
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- name: run display version on remote devices
|
- name: run display version on remote devices
|
||||||
ce_command:
|
ce_command:
|
||||||
commands: display version
|
commands: display version
|
||||||
|
|
|
@ -186,6 +186,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# In vars file
|
# In vars file
|
||||||
# ============
|
# ============
|
||||||
|
---
|
||||||
cl_bonds:
|
cl_bonds:
|
||||||
bond0:
|
bond0:
|
||||||
alias_name: uplink to isp
|
alias_name: uplink to isp
|
||||||
|
|
|
@ -140,6 +140,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# In vars file
|
# In vars file
|
||||||
# ============
|
# ============
|
||||||
|
---
|
||||||
cl_bridge:
|
cl_bridge:
|
||||||
br0:
|
br0:
|
||||||
alias_name: 'vlan aware bridge'
|
alias_name: 'vlan aware bridge'
|
||||||
|
|
|
@ -146,7 +146,7 @@ EXAMPLES = '''
|
||||||
# define cl_interfaces once in tasks
|
# define cl_interfaces once in tasks
|
||||||
# then write interfaces in variables file
|
# then write interfaces in variables file
|
||||||
# with just the options you want.
|
# with just the options you want.
|
||||||
- name: Create interfaces
|
- name: Create interfaces
|
||||||
cl_interface:
|
cl_interface:
|
||||||
name: '{{ item.key }}'
|
name: '{{ item.key }}'
|
||||||
ipv4: '{{ item.value.ipv4 | default(omit) }}'
|
ipv4: '{{ item.value.ipv4 | default(omit) }}'
|
||||||
|
@ -170,6 +170,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# In vars file
|
# In vars file
|
||||||
# ============
|
# ============
|
||||||
|
---
|
||||||
cl_interfaces:
|
cl_interfaces:
|
||||||
swp1:
|
swp1:
|
||||||
alias_name: uplink to isp
|
alias_name: uplink to isp
|
||||||
|
|
|
@ -49,7 +49,7 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
Example playbook entries using the cl_interface_policy module.
|
# Example playbook entries using the cl_interface_policy module.
|
||||||
|
|
||||||
- name: shows types of interface ranges supported
|
- name: shows types of interface ranges supported
|
||||||
cl_interface_policy:
|
cl_interface_policy:
|
||||||
|
|
|
@ -89,10 +89,7 @@ EXAMPLES = '''
|
||||||
state: reloaded
|
state: reloaded
|
||||||
|
|
||||||
# Force all switches to accept a new license. Typically not needed
|
# Force all switches to accept a new license. Typically not needed
|
||||||
ansible -m cl_license -a "src='http://10.1.1.1/new_lic' force=yes" -u root all
|
# ansible -m cl_license -a "src='http://10.1.1.1/new_lic' force=yes" -u root all
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
|
@ -87,20 +87,20 @@ tasks:
|
||||||
- name: run show version on remote devices
|
- name: run show version on remote devices
|
||||||
dellos6_command:
|
dellos6_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
provider "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- name: run show version and check to see if output contains Dell
|
- name: run show version and check to see if output contains Dell
|
||||||
dellos6_command:
|
dellos6_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
wait_for: result[0] contains Dell
|
wait_for: result[0] contains Dell
|
||||||
provider "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- name: run multiple commands on remote nodes
|
- name: run multiple commands on remote nodes
|
||||||
dellos6_command:
|
dellos6_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
- show interfaces
|
- show interfaces
|
||||||
provider "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
|
|
||||||
- name: run multiple commands and evaluate the output
|
- name: run multiple commands and evaluate the output
|
||||||
dellos6_command:
|
dellos6_command:
|
||||||
|
@ -110,7 +110,7 @@ tasks:
|
||||||
wait_for:
|
wait_for:
|
||||||
- result[0] contains Dell
|
- result[0] contains Dell
|
||||||
- result[1] contains Access
|
- result[1] contains Access
|
||||||
provider "{{ cli }}"
|
provider: "{{ cli }}"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
|
|
|
@ -136,7 +136,7 @@ EXAMPLES = '''
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
# create a my.com CNAME record to example.com
|
# create a my.com CNAME record to example.com
|
||||||
- dnsimple
|
- dnsimple:
|
||||||
domain: my.com
|
domain: my.com
|
||||||
record: ''
|
record: ''
|
||||||
type: CNAME
|
type: CNAME
|
||||||
|
|
|
@ -199,7 +199,7 @@ EXAMPLES = '''
|
||||||
state: "present"
|
state: "present"
|
||||||
name: "my-pool"
|
name: "my-pool"
|
||||||
partition: "Common"
|
partition: "Common"
|
||||||
host: "{{ ansible_default_ipv4["address"] }}"
|
host: "{{ ansible_default_ipv4['address'] }}"
|
||||||
port: 80
|
port: 80
|
||||||
|
|
||||||
- name: Remove pool member from pool
|
- name: Remove pool member from pool
|
||||||
|
@ -210,7 +210,7 @@ EXAMPLES = '''
|
||||||
state: "absent"
|
state: "absent"
|
||||||
name: "my-pool"
|
name: "my-pool"
|
||||||
partition: "Common"
|
partition: "Common"
|
||||||
host: "{{ ansible_default_ipv4["address"] }}"
|
host: "{{ ansible_default_ipv4['address'] }}"
|
||||||
port: 80
|
port: 80
|
||||||
|
|
||||||
- name: Delete pool
|
- name: Delete pool
|
||||||
|
|
|
@ -132,7 +132,7 @@ EXAMPLES = '''
|
||||||
state: "present"
|
state: "present"
|
||||||
pool: "my-pool"
|
pool: "my-pool"
|
||||||
partition: "Common"
|
partition: "Common"
|
||||||
host: "{{ ansible_default_ipv4["address"] }}"
|
host: "{{ ansible_default_ipv4['address'] }}"
|
||||||
port: 80
|
port: 80
|
||||||
description: "web server"
|
description: "web server"
|
||||||
connection_limit: 100
|
connection_limit: 100
|
||||||
|
@ -148,7 +148,7 @@ EXAMPLES = '''
|
||||||
state: "present"
|
state: "present"
|
||||||
pool: "my-pool"
|
pool: "my-pool"
|
||||||
partition: "Common"
|
partition: "Common"
|
||||||
host: "{{ ansible_default_ipv4["address"] }}"
|
host: "{{ ansible_default_ipv4['address'] }}"
|
||||||
port: 80
|
port: 80
|
||||||
ratio: 1
|
ratio: 1
|
||||||
description: "nginx server"
|
description: "nginx server"
|
||||||
|
@ -162,7 +162,7 @@ EXAMPLES = '''
|
||||||
state: "absent"
|
state: "absent"
|
||||||
pool: "my-pool"
|
pool: "my-pool"
|
||||||
partition: "Common"
|
partition: "Common"
|
||||||
host: "{{ ansible_default_ipv4["address"] }}"
|
host: "{{ ansible_default_ipv4['address'] }}"
|
||||||
port: 80
|
port: 80
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ EXAMPLES = '''
|
||||||
monitor_state: "disabled"
|
monitor_state: "disabled"
|
||||||
pool: "my-pool"
|
pool: "my-pool"
|
||||||
partition: "Common"
|
partition: "Common"
|
||||||
host: "{{ ansible_default_ipv4["address"] }}"
|
host: "{{ ansible_default_ipv4['address'] }}"
|
||||||
port: 80
|
port: 80
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -49,6 +49,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -56,6 +57,7 @@ vars:
|
||||||
password: cisco
|
password: cisco
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
# Collect all facts from the device
|
# Collect all facts from the device
|
||||||
- ios_facts:
|
- ios_facts:
|
||||||
gather_subset: all
|
gather_subset: all
|
||||||
|
|
|
@ -99,10 +99,12 @@ EXAMPLES = """
|
||||||
comment: update system config
|
comment: update system config
|
||||||
|
|
||||||
- name: replace config hierarchy
|
- name: replace config hierarchy
|
||||||
|
junos_template:
|
||||||
src: config.j2
|
src: config.j2
|
||||||
action: replace
|
action: replace
|
||||||
|
|
||||||
- name: overwrite the config
|
- name: overwrite the config
|
||||||
|
junos_template:
|
||||||
src: config.j2
|
src: config.j2
|
||||||
action: overwrite
|
action: overwrite
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -110,12 +110,14 @@ notes:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
netconf:
|
netconf:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
username: ansible
|
username: ansible
|
||||||
password: Ansible
|
password: Ansible
|
||||||
|
|
||||||
|
---
|
||||||
- name: run a set of commands
|
- name: run a set of commands
|
||||||
junos_command:
|
junos_command:
|
||||||
commands: ['show version', 'show ip route']
|
commands: ['show version', 'show ip route']
|
||||||
|
|
|
@ -146,12 +146,14 @@ notes:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
netconf:
|
netconf:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
username: ansible
|
username: ansible
|
||||||
password: Ansible
|
password: Ansible
|
||||||
|
|
||||||
|
---
|
||||||
- name: load configure file into device
|
- name: load configure file into device
|
||||||
junos_config:
|
junos_config:
|
||||||
src: srx.cfg
|
src: srx.cfg
|
||||||
|
|
|
@ -58,6 +58,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -65,6 +66,7 @@ vars:
|
||||||
password: Ansible
|
password: Ansible
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- name: enable netconf service on port 830
|
- name: enable netconf service on port 830
|
||||||
junos_netconf:
|
junos_netconf:
|
||||||
listens_on: 830
|
listens_on: 830
|
||||||
|
|
|
@ -394,8 +394,6 @@ EXAMPLES='''
|
||||||
- '{{ nmcli_ethernet }}'
|
- '{{ nmcli_ethernet }}'
|
||||||
|
|
||||||
## playbook-del.yml example
|
## playbook-del.yml example
|
||||||
|
|
||||||
---
|
|
||||||
- hosts: openstack-stage
|
- hosts: openstack-stage
|
||||||
remote_user: root
|
remote_user: root
|
||||||
tasks:
|
tasks:
|
||||||
|
|
|
@ -259,8 +259,8 @@ options:
|
||||||
choices: ['present','absent']
|
choices: ['present','absent']
|
||||||
'''
|
'''
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
configure RR client
|
- name: configure RR client
|
||||||
- nxos_bgp_neighbor_af:
|
nxos_bgp_neighbor_af:
|
||||||
asn: 65535
|
asn: 65535
|
||||||
neighbor: '3.3.3.3'
|
neighbor: '3.3.3.3'
|
||||||
afi: ipv4
|
afi: ipv4
|
||||||
|
|
|
@ -91,6 +91,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -98,6 +99,7 @@ vars:
|
||||||
password: admin
|
password: admin
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- name: run show version on remote devices
|
- name: run show version on remote devices
|
||||||
nxos_command:
|
nxos_command:
|
||||||
commands: show version
|
commands: show version
|
||||||
|
|
|
@ -164,6 +164,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -171,6 +172,7 @@ vars:
|
||||||
password: admin
|
password: admin
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- name: configure top level configuration and save it
|
- name: configure top level configuration and save it
|
||||||
nxos_config:
|
nxos_config:
|
||||||
lines: hostname {{ inventory_hostname }}
|
lines: hostname {{ inventory_hostname }}
|
||||||
|
|
|
@ -53,6 +53,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -60,6 +61,7 @@ vars:
|
||||||
password: admin
|
password: admin
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- nxos_facts:
|
- nxos_facts:
|
||||||
gather_subset: all
|
gather_subset: all
|
||||||
|
|
||||||
|
|
|
@ -89,48 +89,49 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name Ensure an interface is a Layer 3 port and that it has the proper description
|
- name: Ensure an interface is a Layer 3 port and that it has the proper description
|
||||||
nxos_interface:
|
nxos_interface:
|
||||||
interface: Ethernet1/1
|
interface: Ethernet1/1
|
||||||
description: 'Configured by Ansible'
|
description: 'Configured by Ansible'
|
||||||
mode: layer3
|
mode: layer3
|
||||||
host: 68.170.147.165
|
host: 68.170.147.165
|
||||||
|
|
||||||
- name Admin down an interface
|
- name: Admin down an interface
|
||||||
nxos_interface:
|
nxos_interface:
|
||||||
interface: Ethernet2/1
|
interface: Ethernet2/1
|
||||||
host: 68.170.147.165
|
host: 68.170.147.165
|
||||||
admin_state: down
|
admin_state: down
|
||||||
|
|
||||||
- name Remove all loopback interfaces
|
- name: Remove all loopback interfaces
|
||||||
nxos_interface:
|
nxos_interface:
|
||||||
interface: loopback
|
interface: loopback
|
||||||
state: absent
|
state: absent
|
||||||
host: 68.170.147.165
|
host: 68.170.147.165
|
||||||
|
|
||||||
- name Remove all logical interfaces
|
- name: Remove all logical interfaces
|
||||||
nxos_interface:
|
nxos_interface:
|
||||||
interface_type: "{{ item }} "
|
interface_type: "{{ item }} "
|
||||||
state: absent
|
state: absent
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
|
||||||
with_items:
|
with_items:
|
||||||
- loopback
|
- loopback
|
||||||
- portchannel
|
- portchannel
|
||||||
- svi
|
- svi
|
||||||
- nve
|
- nve
|
||||||
- name Admin up all ethernet interfaces
|
|
||||||
|
- name: Admin up all ethernet interfaces
|
||||||
nxos_interface:
|
nxos_interface:
|
||||||
interface: ethernet
|
interface: ethernet
|
||||||
host: 68.170.147.165
|
host: 68.170.147.165
|
||||||
admin_state: up
|
admin_state: up
|
||||||
|
|
||||||
- name Admin down ALL interfaces (physical and logical)
|
- name: Admin down ALL interfaces (physical and logical)
|
||||||
nxos_interface:
|
nxos_interface:
|
||||||
interface: all
|
interface: all
|
||||||
host: 68.170.147.165
|
host: 68.170.147.165
|
||||||
admin_state: down
|
admin_state: down
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
proposed:
|
proposed:
|
||||||
description: k/v pairs of parameters passed into module
|
description: k/v pairs of parameters passed into module
|
||||||
|
|
|
@ -85,6 +85,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -92,6 +93,7 @@ vars:
|
||||||
password: netop
|
password: netop
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- ops_command:
|
- ops_command:
|
||||||
commands:
|
commands:
|
||||||
- show version
|
- show version
|
||||||
|
|
|
@ -139,12 +139,14 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
username: netop
|
username: netop
|
||||||
password: netop
|
password: netop
|
||||||
|
|
||||||
|
---
|
||||||
- name: configure hostname over cli
|
- name: configure hostname over cli
|
||||||
ops_config:
|
ops_config:
|
||||||
lines:
|
lines:
|
||||||
|
|
|
@ -73,6 +73,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -85,6 +86,7 @@ vars:
|
||||||
password: netop
|
password: netop
|
||||||
transport: rest
|
transport: rest
|
||||||
|
|
||||||
|
---
|
||||||
- ops_facts:
|
- ops_facts:
|
||||||
gather_subset: all
|
gather_subset: all
|
||||||
provider: "{{ rest }}"
|
provider: "{{ rest }}"
|
||||||
|
|
|
@ -85,6 +85,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -92,6 +93,7 @@ vars:
|
||||||
password: admin
|
password: admin
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
tasks:
|
tasks:
|
||||||
- name: run show version on remote devices
|
- name: run show version on remote devices
|
||||||
sros_command:
|
sros_command:
|
||||||
|
|
|
@ -160,6 +160,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -167,6 +168,7 @@ vars:
|
||||||
password: admin
|
password: admin
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- name: enable rollback location
|
- name: enable rollback location
|
||||||
sros_config:
|
sros_config:
|
||||||
lines: configure system rollback rollback-location "cf3:/ansible"
|
lines: configure system rollback rollback-location "cf3:/ansible"
|
||||||
|
|
|
@ -79,6 +79,7 @@ options:
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Note: examples below use the following provider dict to handle
|
# Note: examples below use the following provider dict to handle
|
||||||
# transport and authentication to the node.
|
# transport and authentication to the node.
|
||||||
|
---
|
||||||
vars:
|
vars:
|
||||||
cli:
|
cli:
|
||||||
host: "{{ inventory_hostname }}"
|
host: "{{ inventory_hostname }}"
|
||||||
|
@ -86,6 +87,7 @@ vars:
|
||||||
password: admin
|
password: admin
|
||||||
transport: cli
|
transport: cli
|
||||||
|
|
||||||
|
---
|
||||||
- name: configure rollback location
|
- name: configure rollback location
|
||||||
sros_rollback:
|
sros_rollback:
|
||||||
rollback_location: "cb3:/ansible"
|
rollback_location: "cb3:/ansible"
|
||||||
|
|
|
@ -84,7 +84,7 @@ EXAMPLES = '''
|
||||||
msg: Ansible task finished
|
msg: Ansible task finished
|
||||||
|
|
||||||
# send a message, specifying the host and port
|
# send a message, specifying the host and port
|
||||||
- jabber
|
- jabber:
|
||||||
user: mybot@example.net
|
user: mybot@example.net
|
||||||
host: talk.example.net
|
host: talk.example.net
|
||||||
port: 5223
|
port: 5223
|
||||||
|
|
|
@ -124,7 +124,7 @@ EXAMPLES = '''
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
||||||
# send an email to more than one recipient that the build failed
|
# send an email to more than one recipient that the build failed
|
||||||
- sendgrid
|
- sendgrid:
|
||||||
username: "{{ sendgrid_username }}"
|
username: "{{ sendgrid_username }}"
|
||||||
password: "{{ sendgrid_password }}"
|
password: "{{ sendgrid_password }}"
|
||||||
from_address: "build@mycompany.com"
|
from_address: "build@mycompany.com"
|
||||||
|
|
|
@ -162,7 +162,7 @@ EXAMPLES = """
|
||||||
title: System load
|
title: System load
|
||||||
fields:
|
fields:
|
||||||
- title: System A
|
- title: System A
|
||||||
value: load average: 0,74, 0,66, 0,63"
|
value: "load average: 0,74, 0,66, 0,63"
|
||||||
short: True
|
short: True
|
||||||
- title: System B
|
- title: System B
|
||||||
value: 'load average: 5,16, 4,64, 2,43'
|
value: 'load average: 5,16, 4,64, 2,43'
|
||||||
|
|
|
@ -54,8 +54,8 @@ options:
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
|
|
||||||
send a message to chat in playbook
|
- name: send a message to chat in playbook
|
||||||
- telegram:
|
telegram:
|
||||||
token: 'bot9999999:XXXXXXXXXXXXXXXXXXXXXXX'
|
token: 'bot9999999:XXXXXXXXXXXXXXXXXXXXXXX'
|
||||||
chat_id: 000000
|
chat_id: 000000
|
||||||
msg: Ansible task finished
|
msg: Ansible task finished
|
||||||
|
|
|
@ -81,44 +81,44 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
description: Install "coffee-script" node.js package.
|
- name: Install "coffee-script" node.js package.
|
||||||
- npm:
|
npm:
|
||||||
name: coffee-script
|
name: coffee-script
|
||||||
path: /app/location
|
path: /app/location
|
||||||
|
|
||||||
description: Install "coffee-script" node.js package on version 1.6.1.
|
- name: Install "coffee-script" node.js package on version 1.6.1.
|
||||||
- npm:
|
npm:
|
||||||
name: coffee-script
|
name: coffee-script
|
||||||
version: '1.6.1'
|
version: '1.6.1'
|
||||||
path: /app/location
|
path: /app/location
|
||||||
|
|
||||||
description: Install "coffee-script" node.js package globally.
|
- name: Install "coffee-script" node.js package globally.
|
||||||
- npm:
|
npm:
|
||||||
name: coffee-script
|
name: coffee-script
|
||||||
global: yes
|
global: yes
|
||||||
|
|
||||||
description: Remove the globally package "coffee-script".
|
- name: Remove the globally package "coffee-script".
|
||||||
- npm:
|
npm:
|
||||||
name: coffee-script
|
name: coffee-script
|
||||||
global: yes
|
global: yes
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
description: Install "coffee-script" node.js package from custom registry.
|
- name: Install "coffee-script" node.js package from custom registry.
|
||||||
- npm:
|
npm:
|
||||||
name: coffee-script
|
name: coffee-script
|
||||||
registry: 'http://registry.mysite.com'
|
registry: 'http://registry.mysite.com'
|
||||||
|
|
||||||
description: Install packages based on package.json.
|
- name: Install packages based on package.json.
|
||||||
- npm:
|
npm:
|
||||||
path: /app/location
|
path: /app/location
|
||||||
|
|
||||||
description: Update packages based on package.json to their latest version.
|
- name: Update packages based on package.json to their latest version.
|
||||||
- npm:
|
npm:
|
||||||
path: /app/location
|
path: /app/location
|
||||||
state: latest
|
state: latest
|
||||||
|
|
||||||
description: Install packages based on package.json using the npm installed with nvm v0.10.1.
|
- name: Install packages based on package.json using the npm installed with nvm v0.10.1.
|
||||||
- npm:
|
npm:
|
||||||
path: /app/location
|
path: /app/location
|
||||||
executable: /opt/nvm/v0.10.1/bin/npm
|
executable: /opt/nvm/v0.10.1/bin/npm
|
||||||
state: present
|
state: present
|
||||||
|
|
|
@ -128,8 +128,8 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Playbook: make sure spells with/without required dependencies (if any) are installed
|
# Playbook: make sure spells with/without required dependencies (if any) are installed
|
||||||
- sorcery:
|
- sorcery:
|
||||||
name: {{ item.spell }}
|
name: "{{ item.spell }}"
|
||||||
depends: {{ item.depends | default(None) }}
|
depends: "{{ item.depends | default(None) }}"
|
||||||
state: present
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- { spell: 'vifm', depends: '+file,-gtk+2' }
|
- { spell: 'vifm', depends: '+file,-gtk+2' }
|
||||||
|
|
|
@ -145,7 +145,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Force refresh of a repository
|
# Force refresh of a repository
|
||||||
- zypper_repository:
|
- zypper_repository:
|
||||||
repo: 'http://my_internal_ci_repo/repo
|
repo: 'http://my_internal_ci_repo/repo'
|
||||||
name: my_ci_repo
|
name: my_ci_repo
|
||||||
state: present
|
state: present
|
||||||
runrefresh: yes
|
runrefresh: yes
|
||||||
|
|
|
@ -57,7 +57,8 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
Simple Example:
|
---
|
||||||
|
# Simple Example:
|
||||||
|
|
||||||
- name: "Create Product"
|
- name: "Create Product"
|
||||||
local_action:
|
local_action:
|
||||||
|
@ -69,9 +70,8 @@ Simple Example:
|
||||||
params:
|
params:
|
||||||
name: "Centos 7"
|
name: "Centos 7"
|
||||||
|
|
||||||
Abstraction Example:
|
# Abstraction Example:
|
||||||
|
# katello.yml
|
||||||
katello.yml
|
|
||||||
---
|
---
|
||||||
- name: "{{ name }}"
|
- name: "{{ name }}"
|
||||||
local_action:
|
local_action:
|
||||||
|
@ -82,7 +82,7 @@ katello.yml
|
||||||
entity: "{{ entity }}"
|
entity: "{{ entity }}"
|
||||||
params: "{{ params }}"
|
params: "{{ params }}"
|
||||||
|
|
||||||
tasks.yml
|
# tasks.yml
|
||||||
---
|
---
|
||||||
- include: katello.yml
|
- include: katello.yml
|
||||||
vars:
|
vars:
|
||||||
|
|
|
@ -96,7 +96,7 @@ EXAMPLES = """
|
||||||
- name: Snapshot volume
|
- name: Snapshot volume
|
||||||
netapp_e_snapshot_volume:
|
netapp_e_snapshot_volume:
|
||||||
ssid: "{{ ssid }}"
|
ssid: "{{ ssid }}"
|
||||||
api_url: "{{ netapp_api_url }}"/
|
api_url: "{{ netapp_api_url }}/"
|
||||||
api_username: "{{ netapp_api_username }}"
|
api_username: "{{ netapp_api_username }}"
|
||||||
api_password: "{{ netapp_api_password }}"
|
api_password: "{{ netapp_api_password }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
|
@ -78,13 +78,19 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
name: Gather facts about ZFS dataset rpool/export/home
|
- name: Gather facts about ZFS dataset rpool/export/home
|
||||||
zfs_facts: dataset=rpool/export/home
|
zfs_facts:
|
||||||
|
dataset: rpool/export/home
|
||||||
|
|
||||||
name: Report space usage on ZFS filesystems under data/home
|
- name: Report space usage on ZFS filesystems under data/home
|
||||||
zfs_facts: name=data/home recurse=yes type=filesystem
|
zfs_facts:
|
||||||
debug: msg='ZFS dataset {{ item.name }} consumes {{ item.used }} of disk space.'
|
name: data/home
|
||||||
with_items: '{{ ansible_zfs_datasets }}
|
recurse: yes
|
||||||
|
type: filesystem
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: 'ZFS dataset {{ item.name }} consumes {{ item.used }} of disk space.'
|
||||||
|
with_items: '{{ ansible_zfs_datasets }}'
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RETURN = '''
|
RETURN = '''
|
||||||
|
|
|
@ -91,7 +91,7 @@ EXAMPLES = '''
|
||||||
state: opts_present
|
state: opts_present
|
||||||
opts: discard
|
opts: discard
|
||||||
with_items: '{{ ansible_mounts }}'
|
with_items: '{{ ansible_mounts }}'
|
||||||
when: '/dev/mapper/luks-' in {{ item.device }}
|
when: "'/dev/mapper/luks-' in {{ item.device }}"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
|
|
|
@ -136,7 +136,7 @@ EXAMPLES = """
|
||||||
control: required
|
control: required
|
||||||
module_path: pam_faillock.so
|
module_path: pam_faillock.so
|
||||||
new_type: auth
|
new_type: auth
|
||||||
new_control=sufficient
|
new_control: sufficient
|
||||||
new_module_path: pam_faillock.so
|
new_module_path: pam_faillock.so
|
||||||
state: after
|
state: after
|
||||||
|
|
||||||
|
|
|
@ -92,28 +92,28 @@ author:
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
# Display facts from all hosts and store them indexed by I(hostname) at C(/tmp/facts).
|
# Display facts from all hosts and store them indexed by I(hostname) at C(/tmp/facts).
|
||||||
ansible all -m setup --tree /tmp/facts
|
# ansible all -m setup --tree /tmp/facts
|
||||||
|
|
||||||
# Display only facts regarding memory found by ansible on all hosts and output them.
|
# Display only facts regarding memory found by ansible on all hosts and output them.
|
||||||
ansible all -m setup -a 'filter=ansible_*_mb'
|
# ansible all -m setup -a 'filter=ansible_*_mb'
|
||||||
|
|
||||||
# Display only facts returned by facter.
|
# Display only facts returned by facter.
|
||||||
ansible all -m setup -a 'filter=facter_*'
|
# ansible all -m setup -a 'filter=facter_*'
|
||||||
|
|
||||||
# Display only facts about certain interfaces.
|
# Display only facts about certain interfaces.
|
||||||
ansible all -m setup -a 'filter=ansible_eth[0-2]'
|
# ansible all -m setup -a 'filter=ansible_eth[0-2]'
|
||||||
|
|
||||||
# Restrict additional gathered facts to network and virtual.
|
# Restrict additional gathered facts to network and virtual.
|
||||||
ansible all -m setup -a 'gather_subset=network,virtual'
|
# ansible all -m setup -a 'gather_subset=network,virtual'
|
||||||
|
|
||||||
# Do not call puppet facter or ohai even if present.
|
# Do not call puppet facter or ohai even if present.
|
||||||
ansible all -m setup -a 'gather_subset=!facter,!ohai'
|
# ansible all -m setup -a 'gather_subset=!facter,!ohai'
|
||||||
|
|
||||||
# Only collect the minimum amount of facts:
|
# Only collect the minimum amount of facts:
|
||||||
ansible all -m setup -a 'gather_subset=!all'
|
# ansible all -m setup -a 'gather_subset=!all'
|
||||||
|
|
||||||
# Display facts from Windows hosts with custom facts stored in C(C:\\custom_facts).
|
# Display facts from Windows hosts with custom facts stored in C(C:\\custom_facts).
|
||||||
ansible windows -m setup -a "fact_path='c:\\custom_facts'"
|
# ansible windows -m setup -a "fact_path='c:\\custom_facts'"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -130,42 +130,42 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# General explanation, starting with an example folder structure for a project:
|
# General explanation, starting with an example folder structure for a project:
|
||||||
|
|
||||||
root:
|
# root:
|
||||||
releases:
|
# releases:
|
||||||
- 20140415234508
|
# - 20140415234508
|
||||||
- 20140415235146
|
# - 20140415235146
|
||||||
- 20140416082818
|
# - 20140416082818
|
||||||
|
#
|
||||||
shared:
|
# shared:
|
||||||
- sessions
|
# - sessions
|
||||||
- uploads
|
# - uploads
|
||||||
|
#
|
||||||
current: -> releases/20140416082818
|
# current: releases/20140416082818
|
||||||
|
|
||||||
|
|
||||||
The 'releases' folder holds all the available releases. A release is a complete build of the application being
|
# The 'releases' folder holds all the available releases. A release is a complete build of the application being
|
||||||
deployed. This can be a clone of a repository for example, or a sync of a local folder on your filesystem.
|
# deployed. This can be a clone of a repository for example, or a sync of a local folder on your filesystem.
|
||||||
Having timestamped folders is one way of having distinct releases, but you could choose your own strategy like
|
# Having timestamped folders is one way of having distinct releases, but you could choose your own strategy like
|
||||||
git tags or commit hashes.
|
# git tags or commit hashes.
|
||||||
|
#
|
||||||
During a deploy, a new folder should be created in the releases folder and any build steps required should be
|
# During a deploy, a new folder should be created in the releases folder and any build steps required should be
|
||||||
performed. Once the new build is ready, the deploy procedure is 'finalized' by replacing the 'current' symlink
|
# performed. Once the new build is ready, the deploy procedure is 'finalized' by replacing the 'current' symlink
|
||||||
with a link to this build.
|
# with a link to this build.
|
||||||
|
#
|
||||||
The 'shared' folder holds any resource that is shared between releases. Examples of this are web-server
|
# The 'shared' folder holds any resource that is shared between releases. Examples of this are web-server
|
||||||
session files, or files uploaded by users of your application. It's quite common to have symlinks from a release
|
# session files, or files uploaded by users of your application. It's quite common to have symlinks from a release
|
||||||
folder pointing to a shared/subfolder, and creating these links would be automated as part of the build steps.
|
# folder pointing to a shared/subfolder, and creating these links would be automated as part of the build steps.
|
||||||
|
#
|
||||||
The 'current' symlink points to one of the releases. Probably the latest one, unless a deploy is in progress.
|
# The 'current' symlink points to one of the releases. Probably the latest one, unless a deploy is in progress.
|
||||||
The web-server's root for the project will go through this symlink, so the 'downtime' when switching to a new
|
# The web-server's root for the project will go through this symlink, so the 'downtime' when switching to a new
|
||||||
release is reduced to the time it takes to switch the link.
|
# release is reduced to the time it takes to switch the link.
|
||||||
|
#
|
||||||
To distinguish between successful builds and unfinished ones, a file can be placed in the folder of the release
|
# To distinguish between successful builds and unfinished ones, a file can be placed in the folder of the release
|
||||||
that is currently in progress. The existence of this file will mark it as unfinished, and allow an automated
|
# that is currently in progress. The existence of this file will mark it as unfinished, and allow an automated
|
||||||
procedure to remove it during cleanup.
|
# procedure to remove it during cleanup.
|
||||||
|
|
||||||
|
|
||||||
# Typical usage:
|
# Typical usage
|
||||||
- name: Initialize the deploy root and gather facts
|
- name: Initialize the deploy root and gather facts
|
||||||
deploy_helper:
|
deploy_helper:
|
||||||
path: /path/to/root
|
path: /path/to/root
|
||||||
|
|
|
@ -61,7 +61,7 @@ notes:
|
||||||
- The ejabberd configuration file must include mod_admin_extra as a module.
|
- The ejabberd configuration file must include mod_admin_extra as a module.
|
||||||
'''
|
'''
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
Example playbook entries using the ejabberd_user module to manage users state.
|
# Example playbook entries using the ejabberd_user module to manage users state.
|
||||||
|
|
||||||
- name: create a user if it does not exists
|
- name: create a user if it does not exists
|
||||||
ejabberd_user:
|
ejabberd_user:
|
||||||
|
|
|
@ -129,6 +129,7 @@ EXAMPLES = r'''
|
||||||
|
|
||||||
# Remove previously added rule for IIS_IUSRS
|
# Remove previously added rule for IIS_IUSRS
|
||||||
- name: Remove FullControl AccessRule for IIS_IUSRS
|
- name: Remove FullControl AccessRule for IIS_IUSRS
|
||||||
|
win_acl:
|
||||||
path: C:\inetpub\wwwroot\MySite
|
path: C:\inetpub\wwwroot\MySite
|
||||||
user: IIS_IUSRS
|
user: IIS_IUSRS
|
||||||
rights: FullControl
|
rights: FullControl
|
||||||
|
@ -139,6 +140,7 @@ EXAMPLES = r'''
|
||||||
|
|
||||||
# Deny Intern
|
# Deny Intern
|
||||||
- name: Deny Deny
|
- name: Deny Deny
|
||||||
|
win_acl:
|
||||||
path: C:\Administrator\Documents
|
path: C:\Administrator\Documents
|
||||||
user: Intern
|
user: Intern
|
||||||
rights: Read,Write,Modify,FullControl,Delete
|
rights: Read,Write,Modify,FullControl,Delete
|
||||||
|
|
|
@ -149,7 +149,7 @@ EXAMPLES = r'''
|
||||||
# Find files in path based on regex pattern
|
# Find files in path based on regex pattern
|
||||||
- win_find:
|
- win_find:
|
||||||
paths: D:\temp
|
paths: D:\temp
|
||||||
patterns: "out_\d{8}-\d{6}.log"
|
patterns: 'out_\d{8}-\d{6}.log'
|
||||||
|
|
||||||
# Find files older than 1 day
|
# Find files older than 1 day
|
||||||
- win_find:
|
- win_find:
|
||||||
|
|
|
@ -113,7 +113,7 @@ EXAMPLES = r'''
|
||||||
|
|
||||||
# Specify multiple non-zero return codes when successful
|
# Specify multiple non-zero return codes when successful
|
||||||
# In this case we can say that both 0 (SUCCESSFUL) and 3010 (REBOOT REQUIRED) codes are acceptable
|
# In this case we can say that both 0 (SUCCESSFUL) and 3010 (REBOOT REQUIRED) codes are acceptable
|
||||||
- name: 'Microsoft .NET Framework 4.5.1'
|
- name: 'Microsoft .NET Framework 4.5.1'
|
||||||
win_package:
|
win_package:
|
||||||
path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe
|
path: https://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe
|
||||||
productid: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}'
|
productid: '{7DEBE4EB-6B40-3766-BB35-5CBBC385DA37}'
|
||||||
|
|
|
@ -75,11 +75,11 @@ EXAMPLES = r'''
|
||||||
- name: Ensure that system32 and Powershell are present on the global system path, and in the specified order
|
- name: Ensure that system32 and Powershell are present on the global system path, and in the specified order
|
||||||
win_path:
|
win_path:
|
||||||
elements:
|
elements:
|
||||||
- %SystemRoot%\system32
|
- '%SystemRoot%\system32'
|
||||||
- %SystemRoot%\system32\WindowsPowerShell\v1.0
|
- '%SystemRoot%\system32\WindowsPowerShell\v1.0'
|
||||||
|
|
||||||
- name: Ensure that C:\Program Files\MyJavaThing is not on the current user's CLASSPATH
|
- name: Ensure that C:\Program Files\MyJavaThing is not on the current user's CLASSPATH
|
||||||
win_path
|
win_path:
|
||||||
name: CLASSPATH
|
name: CLASSPATH
|
||||||
elements: C:\Program Files\MyJavaThing
|
elements: C:\Program Files\MyJavaThing
|
||||||
scope: user
|
scope: user
|
||||||
|
|
|
@ -42,7 +42,7 @@ author: "Chris Church (@cchurch)"
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r'''
|
||||||
# Test connectivity to a windows host
|
# Test connectivity to a windows host
|
||||||
ansible winserver -m win_ping
|
# ansible winserver -m win_ping
|
||||||
|
|
||||||
# Example from an Ansible Playbook
|
# Example from an Ansible Playbook
|
||||||
- win_ping:
|
- win_ping:
|
||||||
|
|
|
@ -89,7 +89,6 @@ EXAMPLES = r'''
|
||||||
creates: C:\Users\Phil\OldLogs
|
creates: C:\Users\Phil\OldLogs
|
||||||
|
|
||||||
# This playbook example unzips a .zip file and recursively decompresses the contained .gz files and removes all unneeded compressed files after completion.
|
# This playbook example unzips a .zip file and recursively decompresses the contained .gz files and removes all unneeded compressed files after completion.
|
||||||
---
|
|
||||||
- name: Unzip ApplicationLogs.zip and decompress all GZipped log files
|
- name: Unzip ApplicationLogs.zip and decompress all GZipped log files
|
||||||
hosts: all
|
hosts: all
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
@ -102,14 +101,14 @@ EXAMPLES = r'''
|
||||||
rm: true
|
rm: true
|
||||||
|
|
||||||
# Install PSCX to use for extracting a gz file
|
# Install PSCX to use for extracting a gz file
|
||||||
- name: Grab PSCX msi
|
- name: Grab PSCX msi
|
||||||
win_get_url:
|
win_get_url:
|
||||||
url: http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=pscx&DownloadId=923562&FileTime=130585918034470000&Build=20959
|
url: http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=pscx&DownloadId=923562&FileTime=130585918034470000&Build=20959
|
||||||
dest: C:\pscx.msi
|
dest: C:\pscx.msi
|
||||||
- name: Install PSCX
|
- name: Install PSCX
|
||||||
win_msi:
|
win_msi:
|
||||||
path: C:\pscx.msi
|
path: C:\pscx.msi
|
||||||
- name: Unzip gz log
|
- name: Unzip gz log
|
||||||
win_unzip:
|
win_unzip:
|
||||||
src: C:\Logs\application-error-logs.gz
|
src: C:\Logs\application-error-logs.gz
|
||||||
dest: C:\ExtractedLogs\application-error-logs
|
dest: C:\ExtractedLogs\application-error-logs
|
||||||
|
|
|
@ -71,12 +71,20 @@ class CaptureStd():
|
||||||
return self.stdout.getvalue(), self.stderr.getvalue()
|
return self.stdout.getvalue(), self.stderr.getvalue()
|
||||||
|
|
||||||
|
|
||||||
def parse_yaml(value, lineno, module, name):
|
def parse_yaml(value, lineno, module, name, load_all=False):
|
||||||
traces = []
|
traces = []
|
||||||
errors = []
|
errors = []
|
||||||
data = None
|
data = None
|
||||||
|
|
||||||
|
if load_all:
|
||||||
|
loader = yaml.safe_load_all
|
||||||
|
else:
|
||||||
|
loader = yaml.safe_load
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = yaml.safe_load(value)
|
data = loader(value)
|
||||||
|
if load_all:
|
||||||
|
data = list(data)
|
||||||
except yaml.MarkedYAMLError as e:
|
except yaml.MarkedYAMLError as e:
|
||||||
e.problem_mark.line += lineno - 1
|
e.problem_mark.line += lineno - 1
|
||||||
e.problem_mark.name = '%s.%s' % (module, name)
|
e.problem_mark.name = '%s.%s' % (module, name)
|
||||||
|
|
|
@ -471,6 +471,12 @@ class ModuleValidator(Validator):
|
||||||
|
|
||||||
if not bool(doc_info['EXAMPLES']['value']):
|
if not bool(doc_info['EXAMPLES']['value']):
|
||||||
self.errors.append('No EXAMPLES provided')
|
self.errors.append('No EXAMPLES provided')
|
||||||
|
else:
|
||||||
|
_, errors, traces = parse_yaml(doc_info['EXAMPLES']['value'],
|
||||||
|
doc_info['EXAMPLES']['lineno'],
|
||||||
|
self.name, 'EXAMPLES', load_all=True)
|
||||||
|
self.errors.extend(errors)
|
||||||
|
self.traces.extend(traces)
|
||||||
|
|
||||||
if not bool(doc_info['RETURN']['value']):
|
if not bool(doc_info['RETURN']['value']):
|
||||||
if self._is_new_module():
|
if self._is_new_module():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue