Examples syntax batch7 (#5624)

* Change example syntax on nxos_feature module

* Change example syntax on nxos_hsrp module

* Change example syntax on nxos_igmp module

* Change example syntax on nxos_interface module

* Change example syntax on nxos_interface_ospf module

* Change example syntax on nxos_ip_interface module

* Change example syntax on nxos_ping module

* Change example syntax on nxos_switchport module

* Change example syntax on nxos_vlan module

* Change example syntax on nxos_vrf module

* Change example syntax on nxos_vrf_interface module

* Change example syntax on nxos_vrrp module

* Change example syntax on meta module

* Change example syntax on set_fact module

* Change example syntax on win_copy module

* Change example syntax on win_file module

* Change example syntax on win_get_url module

Remove escaping of \ characeter in Windows paths since it's no longer required for single quoted or unquoted values when using multi-line YAML syntax.

* Change example syntax on win_lineinfile module

* Change example syntax on win_msi module

* Change example syntax on win_stat module

* Remove nxos_bgp example from nxos_igmp module

* Mark examples as regexp to avoid syntax error

* Cleanup win_copy.py examples

* Cleanup win_file.py examples

* Remove quotes in win_get_url.py examples

* Cleanup quotes and languare in win_lineinfile.py

* Cleanup examples in win_group.py

* Cleanup examples in win_service.py

* Don't use : in documentation because it breaks the YAML syntax check

* Cleanup win_copy.py examples

* Cleanup win_copy.py examples

* Minor change to fix test failure

* Use single quotes
This commit is contained in:
Sam Doran 2016-11-22 11:07:21 -05:00 committed by Matt Clay
parent bf184b1a92
commit c0c26f83a8
23 changed files with 352 additions and 162 deletions

View file

@ -276,8 +276,8 @@ options:
EXAMPLES = ''' EXAMPLES = '''
# configure a simple asn - name: Configure a simple ASN
- nxos_bgp: nxos_bgp:
asn: 65535 asn: 65535
vrf: test vrf: test
router_id: 1.1.1.1 router_id: 1.1.1.1

View file

@ -41,12 +41,24 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Ensure lacp is enabled - name: Ensure lacp is enabled
- nxos_feature: feature=lacp state=enabled host={{ inventory_hostname }} nxos_feature:
# Ensure ospf is disabled feature: lacp
- nxos_feature: feature=ospf state=disabled host={{ inventory_hostname }} state: enabled
# Ensure vpc is enabled host: "{{ inventory_hostname }}"
- nxos_feature: feature=vpc state=enabled host={{ inventory_hostname }}
- name: Ensure ospf is disabled
nxos_feature:
feature: ospf
state: disabled
host: "{{ inventory_hostname }}"
- name: Ensure vpc is enabled
nxos_feature:
feature: vpc
state: enabled
host: "{{ inventory_hostname }}"
''' '''
RETURN = ''' RETURN = '''

View file

@ -81,12 +81,33 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# ensure hsrp is configured with following params on a SVI - name: Ensure HSRP is configured with following params on a SVI
- nxos_hsrp: group=10 vip=10.1.1.1 priority=150 interface=vlan10 preempt=enabled host=68.170.147.165 nxos_hsrp:
# ensure hsrp is configured with following params on a SVI group: 10
- nxos_hsrp: group=10 vip=10.1.1.1 priority=150 interface=vlan10 preempt=enabled host=68.170.147.165 auth_type=text auth_string=CISCO vip: 10.1.1.1
# removing hsrp config for given interface, group, and vip priority: 150
- nxos_hsrp: group=10 interface=vlan10 vip=10.1.1.1 host=68.170.147.165 state=absent interface: vlan10
preempt: enabled
host: 68.170.147.165
- name: Ensure HSRP is configured with following params on a SVI
nxos_hsrp:
group: 10
vip: 10.1.1.1
priority: 150
interface: vlan10
preempt: enabled
host: 68.170.147.165
auth_type: text
auth_string: CISCO
- name: Remove HSRP config for given interface, group, and VIP
nxos_hsrp:
group: 10
interface: vlan10
vip: 10.1.1.1
host: 68.170.147.165
state: absent
''' '''
RETURN = ''' RETURN = '''

View file

@ -60,23 +60,20 @@ options:
choices: ['present', 'default'] choices: ['present', 'default']
''' '''
EXAMPLES = ''' EXAMPLES = '''
# default igmp global params (all params except restart) - name: Default igmp global params (all params except restart)
- nxos_igmp: state=default host={{ inventory_hostname }} nxos_igmp:
# ensure the following igmp global config exists on the device state: default
- nxos_igmp: flush_routes=true enforce_rtr_alert=true host={{ inventory_hostname }} host: "{{ inventory_hostname }}"
# restart the igmp process
- nxos_igmp: restart=true host={{ inventory_hostname }}
'''
EXAMPLES = ''' - name: Ensure the following igmp global config exists on the device
# configure a simple asn nxos_igmp:
- nxos_bgp: flush_routes: true
asn=65535 enforce_rtr_alert: true
vrf=test host: "{{ inventory_hostname }}"
router_id=1.1.1.1
state=present - name: Restart the igmp process
username: "{{ un }}" nxos_igmp:
password: "{{ pwd }}" restart: true
host: "{{ inventory_hostname }}" host: "{{ inventory_hostname }}"
''' '''

View file

@ -85,23 +85,47 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# 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: interface=Ethernet1/1 description='Configured by Ansible' mode=layer3 host=68.170.147.165 nxos_interface:
# Admin down an interface interface: Ethernet1/1
- nxos_interface: interface=Ethernet2/1 host=68.170.147.165 admin_state=down description: 'Configured by Ansible'
# Remove all loopback interfaces mode: layer3
- nxos_interface: interface=loopback state=absent host=68.170.147.165 host: 68.170.147.165
# Remove all logical interfaces
- nxos_interface: interface_type={{ item }} state=absent host={{ inventory_hostname }} - name Admin down an interface
nxos_interface:
interface: Ethernet2/1
host: 68.170.147.165
admin_state: down
- name Remove all loopback interfaces
nxos_interface:
interface: loopback
state: absent
host: 68.170.147.165
- name Remove all logical interfaces
nxos_interface:
interface_type: "{{ item }} "
state: absent
host: "{{ inventory_hostname }}"
with_items: with_items:
- loopback - loopback
- portchannel - portchannel
- svi - svi
- nve - nve
# Admin up all ethernet interfaces - name Admin up all ethernet interfaces
- nxos_interface: interface=ethernet host=68.170.147.165 admin_state=up nxos_interface:
# Admin down ALL interfaces (physical and logical) interface: ethernet
- nxos_interface: interface=all host=68.170.147.165 admin_state=down host: 68.170.147.165
admin_state: up
- name Admin down ALL interfaces (physical and logical)
nxos_interface:
interface: all
host: 68.170.147.165
admin_state: down
''' '''
RETURN = ''' RETURN = '''
proposed: proposed:

View file

@ -123,7 +123,7 @@ EXAMPLES = '''
interface: ethernet1/32 interface: ethernet1/32
ospf: 1 ospf: 1
area: 1 area: 1
cost=default cost: default
username: "{{ un }}" username: "{{ un }}"
password: "{{ pwd }}" password: "{{ pwd }}"
host: "{{ inventory_hostname }}" host: "{{ inventory_hostname }}"

View file

@ -57,10 +57,23 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# ensure ipv4 address is configured on Ethernet1/32 - name: Ensure ipv4 address is configured on Ethernet1/32
- nxos_ip_interface: interface=Ethernet1/32 transport=nxapi version=v4 state=present addr=20.20.20.20 mask=24 nxos_ip_interface:
# ensure ipv6 address is configured on Ethernet1/31 interface: Ethernet1/32
- nxos_ip_interface: interface=Ethernet1/31 transport=cli version=v6 state=present addr=2001::db8:800:200c:cccb mask=64 transport: nxapi
version: v4
state: present
addr: 20.20.20.20
mask: 24
- name: Ensure ipv6 address is configured on Ethernet1/31
nxos_ip_interface:
interface: Ethernet1/31
transport: cli
version: v6
state: present
addr: '2001::db8:800:200c:cccb'
mask: 64
''' '''
RETURN = ''' RETURN = '''

View file

@ -48,10 +48,17 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# test reachability to 8.8.8.8 using mgmt vrf - name: Test reachability to 8.8.8.8 using mgmt vrf
- nxos_ping: dest=8.8.8.8 vrf=management host=68.170.147.165 nxos_ping:
# Test reachability to a few different public IPs using mgmt vrf dest: 8.8.8.8
- nxos_ping: dest=nxos_ping vrf=management host=68.170.147.165 vrf: management
host: 68.170.147.165
- name: Test reachability to a few different public IPs using mgmt vrf
nxos_ping:
dest: nxos_ping
vrf: management
host: 68.170.147.165
with_items: with_items:
- 8.8.8.8 - 8.8.8.8
- 4.4.4.4 - 4.4.4.4

View file

@ -79,16 +79,42 @@ options:
default: null default: null
''' '''
EXAMPLES = ''' EXAMPLES = '''
# ENSURE Eth1/5 is in its default switchport state - name: Ensure Eth1/5 is in its default switchport state
- nxos_switchport: interface=eth1/5 state=unconfigured host={{ inventory_hostname }} nxos_switchport:
# ENSURE Eth1/5 is configured for access vlan 20 interface: eth1/5
- nxos_switchport: interface=eth1/5 mode=access access_vlan=20 host={{ inventory_hostname }} state: unconfigured
# ENSURE Eth1/5 only has vlans 5-10 as trunk vlans host: "{{ inventory_hostname }}"
- nxos_switchport: interface=eth1/5 mode=trunk native_vlan=10 trunk_vlans=5-10 host={{ inventory_hostname }}
# Ensure eth1/5 is a trunk port and ensure 2-50 are being tagged (doesn't mean others aren't also being tagged) - name: Ensure Eth1/5 is configured for access vlan 20
- nxos_switchport: interface=eth1/5 mode=trunk native_vlan=10 trunk_vlans=2-50 host={{ inventory_hostname }} nxos_switchport:
# Ensure these VLANs are not being tagged on the trunk interface: eth1/5
- nxos_switchport: interface=eth1/5 mode=trunk trunk_vlans=51-4094 host={{ inventory_hostname }} state=absent mode: access
access_vlan: 20
host: "{{ inventory_hostname }}"
- name: Ensure Eth1/5 only has vlans 5-10 as trunk vlans
nxos_switchport:
interface: eth1/5
mode: trunk
native_vlan: 10
trunk_vlans: 5-10
host: "{{ inventory_hostname }}"
- name: Ensure eth1/5 is a trunk port and ensure 2-50 are being tagged (doesn't mean others aren't also being tagged)
nxos_switchport:
interface: eth1/5
mode: trunk
native_vlan: 10
trunk_vlans: 2-50
host: "{{ inventory_hostname }}"
- name: Ensure these VLANs are not being tagged on the trunk
nxos_switchport:
interface: eth1/5
mode: trunk
trunk_vlans: 51-4094
host: "{{ inventory_hostname }} "
state: absent
''' '''
RETURN = ''' RETURN = '''

View file

@ -71,16 +71,33 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Ensure a range of VLANs are not present on the switch - name: Ensure a range of VLANs are not present on the switch
- nxos_vlan: vlan_range="2-10,20,50,55-60,100-150" host=68.170.147.165 username=cisco password=cisco state=absent transport=nxapi nxos_vlan:
vlan_range: "2-10,20,50,55-60,100-150"
# Ensure VLAN 50 exists with the name WEB and is in the shutdown state host: 68.170.147.165
- nxos_vlan: vlan_id=50 host=68.170.147.165 admin_state=down name=WEB transport=nxapi username=cisco password=cisco username: cisco
password: cisco
# Ensure VLAN is NOT on the device state: absent
- nxos_vlan: vlan_id=50 host=68.170.147.165 state=absent transport=nxapi username=cisco password=cisco transport: nxapi
- name: Ensure VLAN 50 exists with the name WEB and is in the shutdown state
nxos_vlan:
vlan_id: 50
host: 68.170.147.165
admin_state: down
name: WEB
transport: nxapi
username: cisco
password: cisco
- name: Ensure VLAN is NOT on the device
nxos_vlan:
vlan_id: 50
host: 68.170.147.165
state: absent
transport: nxapi
username: cisco
password: cisco
''' '''
RETURN = ''' RETURN = '''

View file

@ -76,10 +76,12 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# ensure ntc VRF exists on switch - name: Ensure ntc VRF exists on switch
- nxos_vrf: vrf=ntc host=68.170.147.165 nxos_vrf:
# ensure ntc VRF does not exist on switch vrf: ntc
- nxos_vrf: vrf=ntc host=68.170.147.165 state=absent username: "{{ un }}"
password: "{{ pwd }}"
host: "{{ inventory_hostname }}"
''' '''
RETURN = ''' RETURN = '''

View file

@ -50,10 +50,19 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# ensure vrf ntc exists on Eth1/1 - name: Ensure vrf ntc exists on Eth1/1
- nxos_vrf_interface: vrf=ntc interface=Ethernet1/1 host=68.170.147.165 state=present nxos_vrf_interface:
# ensure ntc VRF does not exist on Eth1/1 vrf: ntc
- nxos_vrf_interface: vrf=ntc interface=Ethernet1/1 host=68.170.147.165 state=absent interface: Ethernet1/1
host: 68.170.147.165
state: present
- name: Ensure ntc VRF does not exist on Eth1/1
nxos_vrf_interface:
vrf: ntc
interface: Ethernet1/1
host: 68.170.147.165
state: absent
''' '''
RETURN = ''' RETURN = '''

View file

@ -74,12 +74,31 @@ options:
''' '''
EXAMPLES = ''' EXAMPLES = '''
# ensure vrrp group 100 and vip 10.1.100.1 is on vlan10 - name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10
- nxos_vrrp: interface=vlan10 group=100 vip=10.1.100.1 host=68.170.147.165 nxos_vrrp:
# ensure removal of the vrrp group config # vip is required to ensure the user knows what they are removing interface: vlan10
- nxos_vrrp: interface=vlan10 group=100 vip=10.1.100.1 state=absent host=68.170.147.165 group: 100
# re-config with more params vip: 10.1.100.1
- nxos_vrrp: interface=vlan10 group=100 vip=10.1.100.1 preempt=false priority=130 authentication=AUTHKEY host=68.170.147.165 host: 68.170.147.165
- name: Ensure removal of the vrrp group config
# vip is required to ensure the user knows what they are removing
nxos_vrrp:
interface: vlan10
group: 100
vip: 10.1.100.1
state: absent
host: 68.170.147.165
- name: Re-config with more params
nxos_vrrp:
interface: vlan10
group: 100
vip: 10.1.100.1
preempt: false
priority: 130
authentication: AUTHKEY
host: 68.170.147.165
''' '''
RETURN = ''' RETURN = '''

View file

@ -47,19 +47,28 @@ author:
EXAMPLES = ''' EXAMPLES = '''
# force all notified handlers to run at this point, not waiting for normal sync points # force all notified handlers to run at this point, not waiting for normal sync points
- template: src=new.j2 dest=/etc/config.txt - template:
src: new.j2
dest: /etc/config.txt
notify: myhandler notify: myhandler
- meta: flush_handlers - meta: flush_handlers
# reload inventory, useful with dynamic inventories when play makes changes to the existing hosts # reload inventory, useful with dynamic inventories when play makes changes to the existing hosts
- cloud_guest: name=newhost state=present # this is fake module - cloud_guest: # this is fake module
- meta: refresh_inventory name: newhost
state: present
# clear gathered facts from all currently targeted hosts - name: Refresh inventory to ensure new instaces exist in inventory
- meta: clear_facts meta: refresh_inventory
- name: Clear gathered facts from all currently targeted hosts
meta: clear_facts
# bring host back to play after failure # bring host back to play after failure
- copy: src=file dest=/etc/file - copy:
src: file
dest: /etc/file
remote_user: imightnothavepermission remote_user: imightnothavepermission
- meta: clear_host_errors - meta: clear_host_errors
''' '''

View file

@ -42,7 +42,9 @@ notes:
EXAMPLES = ''' EXAMPLES = '''
# Example setting host facts using key=value pairs, note that this always creates strings or booleans # Example setting host facts using key=value pairs, note that this always creates strings or booleans
- set_fact: one_fact="something" other_fact="{{ local_var }}" - set_fact:
one_fact: "something"
other_fact: "{{ local_var }}"
# Example setting host facts using complex arguments # Example setting host facts using complex arguments
- set_fact: - set_fact:

View file

@ -47,25 +47,22 @@ author: "Jon Hawkesworth (@jhawkesworth)"
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Copy a single file - name: Copy a single file
- win_copy: src=/srv/myfiles/foo.conf dest=c:\\TEMP\\foo.conf win_copy:
src: /srv/myfiles/foo.conf
# Copy the contents of files/temp_files dir into c:\temp\. Includes any sub dirs under files/temp_files dest: c:\TEMP\foo.conf
# Note the use of unix style path in the dest.
# This is necessary because \ is yaml escape sequence
- win_copy: src=files/temp_files/ dest=c:/temp/
# Copy the files/temp_files dir and any files or sub dirs into c:\temp
# Copies the folder because there is no trailing / on 'files/temp_files'
- win_copy: src=files/temp_files dest=c:/temp/
- name: Copy files/temp_files to c:\temp
win_copy:
src: files/temp_files/
dest: c:\temp
''' '''
RETURN = ''' RETURN = '''
dest: dest:
description: destination file/path description: destination file/path
returned: changed returned: changed
type: string type: string
sample: "c:/temp/" sample: 'c:\temp'
src: src:
description: source file used for the copy on the target machine description: source file used for the copy on the target machine
returned: changed returned: changed

View file

@ -46,27 +46,37 @@ options:
If C(file), the file will NOT be created if it does not exist, see the M(copy) If C(file), the file will NOT be created if it does not exist, see the M(copy)
or M(template) module if you want that behavior. If C(absent), or M(template) module if you want that behavior. If C(absent),
directories will be recursively deleted, and files will be removed. directories will be recursively deleted, and files will be removed.
If C(touch), an empty file will be created if the c(path) does not If C(touch), an empty file will be created if the C(path) does not
exist, while an existing file or directory will receive updated file access and exist, while an existing file or directory will receive updated file access and
modification times (similar to the way `touch` works from the command line). modification times (similar to the way C(touch) works from the command line).
required: false required: false
default: file default: file
choices: [ file, directory, touch, absent ] choices: [ file, directory, touch, absent ]
''' '''
EXAMPLES = ''' EXAMPLES = '''
# create a file - name: Create a file
- win_file: path=C:\\temp\\foo.conf win_file:
path: C:\temp\foo.conf
state: file
# touch a file (creates if not present, updates modification time if present) - name: Touch a file (creates if not present, updates modification time if present)
- win_file: path=C:\\temp\\foo.conf state=touch win_file:
path: C:\temp\foo.conf
state: touch
# remove a file, if present - name: Remove a file, if present
- win_file: path=C:\\temp\\foo.conf state=absent win_file:
path: C:\temp\foo.conf
state: absent
# create directory structure - name: Create directory structure
- win_file: path=C:\\temp\\folder\\subfolder state=directory win_file:
path: C:\temp\folder\subfolder
state: directory
# remove directory structure - name: Remove directory structure
- win_file: path=C:\\temp state=absent win_file:
path: C:\temp
state: absent
''' '''

View file

@ -95,22 +95,22 @@ $ ansible -i hosts -c winrm -m win_get_url -a "url=http://www.example.com/earthr
# Playbook example # Playbook example
- name: Download earthrise.jpg to 'C:\\Users\\RandomUser\\earthrise.jpg' - name: Download earthrise.jpg to 'C:\\Users\\RandomUser\\earthrise.jpg'
win_get_url: win_get_url:
url: 'http://www.example.com/earthrise.jpg' url: http://www.example.com/earthrise.jpg
dest: 'C:\\Users\\RandomUser\\earthrise.jpg' dest: C:\Users\RandomUser\earthrise.jpg
- name: Download earthrise.jpg to 'C:\\Users\\RandomUser\\earthrise.jpg' only if modified - name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg' only if modified
win_get_url: win_get_url:
url: 'http://www.example.com/earthrise.jpg' url: http://www.example.com/earthrise.jpg
dest: 'C:\\Users\\RandomUser\\earthrise.jpg' dest: C:\Users\RandomUser\earthrise.jpg
force: no force: no
- name: Download earthrise.jpg to 'C:\\Users\\RandomUser\\earthrise.jpg' through a proxy server. - name: Download earthrise.jpg to 'C:\Users\RandomUser\earthrise.jpg' through a proxy server.
win_get_url: win_get_url:
url: 'http://www.example.com/earthrise.jpg' url: http://www.example.com/earthrise.jpg
dest: 'C:\\Users\\RandomUser\\earthrise.jpg' dest: C:\Users\RandomUser\earthrise.jpg
proxy_url: 'http://10.0.0.1:8080' proxy_url: http://10.0.0.1:8080
proxy_username: 'username' proxy_username: username
proxy_password: 'password' proxy_password: password
''' '''
RETURN = ''' RETURN = '''
url: url:

View file

@ -54,13 +54,13 @@ author: "Chris Hoffman (@chrishoffman)"
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Create a new group - name: Create a new group
win_group: win_group:
name: deploy name: deploy
description: Deploy Group description: Deploy Group
state: present state: present
# Remove a group - name: Remove a group
win_group: win_group:
name: deploy name: deploy
state: absent state: absent

View file

@ -33,15 +33,11 @@ options:
aliases: [ name, destfile ] aliases: [ name, destfile ]
description: description:
- The path of the file to modify. - The path of the file to modify.
- Note that the Windows path delimiter '\' must be escaped as '\\' (see examples below) - Note that the Windows path delimiter C(\) must be escaped as C(\\) when the line is double quoted.
regexp: regexp:
required: false required: false
description: description:
- The regular expression to look for in every line of the file. For - "The regular expression to look for in every line of the file. For C(state=present), the pattern to replace if found; only the last line found will be replaced. For C(state=absent), the pattern of the line to remove. Uses .NET compatible regular expressions; see U(https://msdn.microsoft.com/en-us/library/hs600312%28v=vs.110%29.aspx)."
C(state=present), the pattern to replace if found; only the last line
found will be replaced. For C(state=absent), the pattern of the line
to remove. Uses .NET compatible regular expressions; see
U(https://msdn.microsoft.com/en-us/library/hs600312%28v=vs.110%29.aspx).
state: state:
required: false required: false
choices: [ present, absent ] choices: [ present, absent ]
@ -118,27 +114,50 @@ options:
newline: newline:
required: false required: false
description: description:
- "Specifies the line separator style to use for the modified file. This defaults to the windows line separator (\r\n). Note that the indicated line separator will be used for file output regardless of the original line separator that appears in the input file." - "Specifies the line separator style to use for the modified file. This defaults to the windows line separator (C(\r\n)). Note that the indicated line separator will be used for file output regardless of the original line separator that appears in the input file."
choices: [ "windows", "unix" ] choices: [ "windows", "unix" ]
default: "windows" default: "windows"
""" """
EXAMPLES = r""" EXAMPLES = r"""
- win_lineinfile: dest=C:\\temp\\example.conf regexp=^name= line="name=JohnDoe" - win_lineinfile:
dest: C:\temp\example.conf
regexp: '^name='
line: 'name=JohnDoe'
- win_lineinfile: dest=C:\\temp\\example.conf state=absent regexp="^name=" - win_lineinfile:
dest: C:\temp\example.conf
regexp: '^name='
state: absent
- win_lineinfile: dest=C:\\temp\\example.conf regexp='^127\.0\.0\.1' line='127.0.0.1 localhost' - win_lineinfile:
dest: C:\temp\example.conf
regexp: '^127\.0\.0\.1'
line: '127.0.0.1 localhost'
- win_lineinfile: dest=C:\\temp\\httpd.conf regexp="^Listen " insertafter="^#Listen " line="Listen 8080" - win_lineinfile:
dest: C:\temp\httpd.conf
regexp: '^Listen '
insertafter: '^#Listen '
line: Listen 8080
- win_lineinfile: dest=C:\\temp\\services regexp="^# port for http" insertbefore="^www.*80/tcp" line="# port for http by default" - win_lineinfile:
dest: C:\temp\services
regexp: '^# port for http'
insertbefore: '^www.*80/tcp'
line: '# port for http by default'
# Create file if it doesn't exist with a specific encoding # Create file if it doesn't exist with a specific encoding
- win_lineinfile: dest=C:\\temp\\utf16.txt create="yes" encoding="utf-16" line="This is a utf-16 encoded file" - win_lineinfile:
dest: C:\temp\utf16.txt
create: yes
encoding: utf-16
line: This is a utf-16 encoded file
# Add a line to a file and ensure the resulting file uses unix line separators # Add a line to a file and ensure the resulting file uses unix line separators
- win_lineinfile: dest=C:\\temp\\testfile.txt line="Line added to file" newline="unix" - win_lineinfile:
dest: C:\temp\testfile.txt
line: Line added to file
newline: unix
""" """

View file

@ -61,13 +61,18 @@ author: Matt Martz
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Install an MSI file - name: Install an MSI file
- win_msi: path=C:\\\\7z920-x64.msi win_msi:
path: C:\7z920-x64.msi
# Install an MSI, and wait for it to complete before continuing - name: Install an MSI, and wait for it to complete before continuing
- win_msi: path=C:\\\\7z920-x64.msi wait=true win_msi:
path: C:\7z920-x64.msi
wait: true
# Uninstall an MSI file - name: Uninstall an MSI file
- win_msi: path=C:\\\\7z920-x64.msi state=absent win_msi:
path: C:\7z920-x64.msi
state: absent
''' '''

View file

@ -59,12 +59,12 @@ author: "Chris Hoffman (@chrishoffman)"
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Restart a service - name: Restart a service
win_service: win_service:
name: spooler name: spooler
state: restarted state: restarted
# Set service startup mode to auto and ensure it is started - name: Set service startup mode to auto and ensure it is started
win_service: win_service:
name: spooler name: spooler
start_mode: auto start_mode: auto

View file

@ -50,11 +50,12 @@ author: "Chris Church (@cchurch)"
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Obtain information about a file - name: Obtain information about a file
win_stat:
- win_stat: path=C:\\foo.ini path: C:\foo.ini
register: file_info register: file_info
- debug: var=file_info - debug:
var: file_info
''' '''