mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
modules: fix examples to use FQCN (#644)
* modules: fix examples to use FQCN * fix * fix * fix
This commit is contained in:
parent
8b92e0454d
commit
41cfdda6a3
533 changed files with 2130 additions and 2130 deletions
|
@ -63,22 +63,22 @@ author:
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Compress directory /path/to/foo/ into /path/to/foo.tgz
|
||||
archive:
|
||||
community.general.archive:
|
||||
path: /path/to/foo
|
||||
dest: /path/to/foo.tgz
|
||||
|
||||
- name: Compress regular file /path/to/foo into /path/to/foo.gz and remove it
|
||||
archive:
|
||||
community.general.archive:
|
||||
path: /path/to/foo
|
||||
remove: yes
|
||||
|
||||
- name: Create a zip archive of /path/to/foo
|
||||
archive:
|
||||
community.general.archive:
|
||||
path: /path/to/foo
|
||||
format: zip
|
||||
|
||||
- name: Create a bz2 archive of multiple files, rooted at /path
|
||||
archive:
|
||||
community.general.archive:
|
||||
path:
|
||||
- /path/to/foo
|
||||
- /path/wong/foo
|
||||
|
@ -86,7 +86,7 @@ EXAMPLES = r'''
|
|||
format: bz2
|
||||
|
||||
- name: Create a bz2 archive of a globbed path, while excluding specific dirnames
|
||||
archive:
|
||||
community.general.archive:
|
||||
path:
|
||||
- /path/to/foo/*
|
||||
dest: /path/file.tar.bz2
|
||||
|
@ -96,7 +96,7 @@ EXAMPLES = r'''
|
|||
format: bz2
|
||||
|
||||
- name: Create a bz2 archive of a globbed path, while excluding a glob of dirnames
|
||||
archive:
|
||||
community.general.archive:
|
||||
path:
|
||||
- /path/to/foo/*
|
||||
dest: /path/file.tar.bz2
|
||||
|
@ -105,13 +105,13 @@ EXAMPLES = r'''
|
|||
format: bz2
|
||||
|
||||
- name: Use gzip to compress a single archive (i.e don't archive it first with tar)
|
||||
archive:
|
||||
community.general.archive:
|
||||
path: /path/to/foo/single.file
|
||||
dest: /path/file.gz
|
||||
format: gz
|
||||
|
||||
- name: Create a tar.gz archive of a single file.
|
||||
archive:
|
||||
community.general.archive:
|
||||
path: /path/to/foo/single.file
|
||||
dest: /path/file.tar.gz
|
||||
format: gz
|
||||
|
|
|
@ -87,7 +87,7 @@ author:
|
|||
EXAMPLES = r'''
|
||||
# Before Ansible 2.3, option 'dest' was used instead of 'path'
|
||||
- name: Ensure "fav=lemonade is in section "[drinks]" in specified file
|
||||
ini_file:
|
||||
community.general.ini_file:
|
||||
path: /etc/conf
|
||||
section: drinks
|
||||
option: fav
|
||||
|
@ -96,7 +96,7 @@ EXAMPLES = r'''
|
|||
backup: yes
|
||||
|
||||
- name: Ensure "temperature=cold is in section "[drinks]" in specified file
|
||||
ini_file:
|
||||
community.general.ini_file:
|
||||
path: /etc/anotherconf
|
||||
section: drinks
|
||||
option: temperature
|
||||
|
|
|
@ -73,7 +73,7 @@ options:
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Create an ISO file
|
||||
iso_create:
|
||||
community.general.iso_create:
|
||||
src_files:
|
||||
- /root/testfile.yml
|
||||
- /root/testfolder
|
||||
|
@ -81,7 +81,7 @@ EXAMPLES = r'''
|
|||
interchange_level: 3
|
||||
|
||||
- name: Create an ISO file with Rock Ridge extension
|
||||
iso_create:
|
||||
community.general.iso_create:
|
||||
src_files:
|
||||
- /root/testfile.yml
|
||||
- /root/testfolder
|
||||
|
|
|
@ -71,7 +71,7 @@ notes:
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Extract kernel and ramdisk from a LiveCD
|
||||
iso_extract:
|
||||
community.general.iso_extract:
|
||||
image: /tmp/rear-test.iso
|
||||
dest: /tmp/virt-rear/
|
||||
files:
|
||||
|
|
|
@ -76,7 +76,7 @@ EXAMPLES = r'''
|
|||
|
||||
# Read a CSV file and access user 'dag'
|
||||
- name: Read users from CSV file and return a dictionary
|
||||
read_csv:
|
||||
community.general.read_csv:
|
||||
path: users.csv
|
||||
key: name
|
||||
register: users
|
||||
|
@ -87,7 +87,7 @@ EXAMPLES = r'''
|
|||
|
||||
# Read a CSV file and access the first item
|
||||
- name: Read users from CSV file and return a list
|
||||
read_csv:
|
||||
community.general.read_csv:
|
||||
path: users.csv
|
||||
register: users
|
||||
delegate_to: localhost
|
||||
|
@ -102,7 +102,7 @@ EXAMPLES = r'''
|
|||
|
||||
# Read a CSV file without headers
|
||||
- name: Read users from CSV file and return a list
|
||||
read_csv:
|
||||
community.general.read_csv:
|
||||
path: users.csv
|
||||
fieldnames: name,uid,gid
|
||||
delimiter: ';'
|
||||
|
|
|
@ -60,30 +60,30 @@ author:
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Obtain the extended attributes of /etc/foo.conf
|
||||
xattr:
|
||||
community.general.xattr:
|
||||
path: /etc/foo.conf
|
||||
|
||||
- name: Set the key 'user.foo' to value 'bar'
|
||||
xattr:
|
||||
community.general.xattr:
|
||||
path: /etc/foo.conf
|
||||
key: foo
|
||||
value: bar
|
||||
|
||||
- name: Set the key 'trusted.glusterfs.volume-id' to value '0x817b94343f164f199e5b573b4ea1f914'
|
||||
xattr:
|
||||
community.general.xattr:
|
||||
path: /mnt/bricks/brick1
|
||||
namespace: trusted
|
||||
key: glusterfs.volume-id
|
||||
value: "0x817b94343f164f199e5b573b4ea1f914"
|
||||
|
||||
- name: Remove the key 'user.foo'
|
||||
xattr:
|
||||
community.general.xattr:
|
||||
path: /etc/foo.conf
|
||||
key: foo
|
||||
state: absent
|
||||
|
||||
- name: Remove the key 'trusted.glusterfs.volume-id'
|
||||
xattr:
|
||||
community.general.xattr:
|
||||
path: /mnt/bricks/brick1
|
||||
namespace: trusted
|
||||
key: glusterfs.volume-id
|
||||
|
|
|
@ -176,20 +176,20 @@ EXAMPLES = r'''
|
|||
# </business>
|
||||
|
||||
- name: Remove the 'subjective' attribute of the 'rating' element
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/rating/@subjective
|
||||
state: absent
|
||||
|
||||
- name: Set the rating to '11'
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/rating
|
||||
value: 11
|
||||
|
||||
# Retrieve and display the number of nodes
|
||||
- name: Get count of 'beers' nodes
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/beers/beer
|
||||
count: yes
|
||||
|
@ -200,13 +200,13 @@ EXAMPLES = r'''
|
|||
|
||||
# Example where parent XML nodes are created automatically
|
||||
- name: Add a 'phonenumber' element to the 'business' element
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/phonenumber
|
||||
value: 555-555-1234
|
||||
|
||||
- name: Add several more beers to the 'beers' element
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/beers
|
||||
add_children:
|
||||
|
@ -215,7 +215,7 @@ EXAMPLES = r'''
|
|||
- beer: Old Curmudgeon
|
||||
|
||||
- name: Add several more beers to the 'beers' element and add them before the 'Rochefort 10' element
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: '/business/beers/beer[text()="Rochefort 10"]'
|
||||
insertbefore: yes
|
||||
|
@ -226,17 +226,17 @@ EXAMPLES = r'''
|
|||
|
||||
# NOTE: The 'state' defaults to 'present' and 'value' defaults to 'null' for elements
|
||||
- name: Add a 'validxhtml' element to the 'website' element
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/website/validxhtml
|
||||
|
||||
- name: Add an empty 'validatedon' attribute to the 'validxhtml' element
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/website/validxhtml/@validatedon
|
||||
|
||||
- name: Add or modify an attribute, add element if needed
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/website/validxhtml
|
||||
attribute: validatedon
|
||||
|
@ -244,7 +244,7 @@ EXAMPLES = r'''
|
|||
|
||||
# How to read an attribute value and access it in Ansible
|
||||
- name: Read an element's attribute values
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/website/validxhtml
|
||||
content: attribute
|
||||
|
@ -255,13 +255,13 @@ EXAMPLES = r'''
|
|||
var: xmlresp.matches[0].validxhtml.validatedon
|
||||
|
||||
- name: Remove all children from the 'website' element (option 1)
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/website/*
|
||||
state: absent
|
||||
|
||||
- name: Remove all children from the 'website' element (option 2)
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: /foo/bar.xml
|
||||
xpath: /business/website
|
||||
children: []
|
||||
|
@ -276,7 +276,7 @@ EXAMPLES = r'''
|
|||
|
||||
# NOTE: There is the prefix 'x' in front of the 'bar' element, too.
|
||||
- name: Set namespaced '/x:foo/x:bar/y:baz/@z:my_namespaced_attribute' to 'false'
|
||||
xml:
|
||||
community.general.xml:
|
||||
path: foo.xml
|
||||
xpath: /x:foo/x:bar/y:baz
|
||||
namespaces:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue