Update EXAMPLES section in modules (#27)

Update EXAMPLES section in modules to use FQCN

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2020-05-21 22:24:20 +05:30 committed by GitHub
parent 147caed10d
commit d9e0140b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 58 additions and 58 deletions

View file

@ -88,7 +88,7 @@ notes:
EXAMPLES = r''' EXAMPLES = r'''
- name: Grant user Joe read access to a file - name: Grant user Joe read access to a file
acl: ansible.posix.acl:
path: /etc/foo.conf path: /etc/foo.conf
entity: joe entity: joe
etype: user etype: user
@ -96,14 +96,14 @@ EXAMPLES = r'''
state: present state: present
- name: Removes the ACL for Joe on a specific file - name: Removes the ACL for Joe on a specific file
acl: ansible.posix.acl:
path: /etc/foo.conf path: /etc/foo.conf
entity: joe entity: joe
etype: user etype: user
state: absent state: absent
- name: Sets default ACL for joe on /etc/foo.d/ - name: Sets default ACL for joe on /etc/foo.d/
acl: ansible.posix.acl:
path: /etc/foo.d/ path: /etc/foo.d/
entity: joe entity: joe
etype: user etype: user
@ -112,13 +112,13 @@ EXAMPLES = r'''
state: present state: present
- name: Same as previous but using entry shorthand - name: Same as previous but using entry shorthand
acl: ansible.posix.acl:
path: /etc/foo.d/ path: /etc/foo.d/
entry: default:user:joe:rw- entry: default:user:joe:rw-
state: present state: present
- name: Obtain the ACL for a specific file - name: Obtain the ACL for a specific file
acl: ansible.posix.acl:
path: /etc/foo.conf path: /etc/foo.conf
register: acl_info register: acl_info
''' '''

View file

@ -55,20 +55,20 @@ author:
- Richard Isaacson (@risaacson) - Richard Isaacson (@risaacson)
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Schedule a command to execute in 20 minutes as root - name: Schedule a command to execute in 20 minutes as root
at: ansible.posix.at:
command: ls -d / >/dev/null command: ls -d / >/dev/null
count: 20 count: 20
units: minutes units: minutes
- name: Match a command to an existing job and delete the job - name: Match a command to an existing job and delete the job
at: ansible.posix.at:
command: ls -d / >/dev/null command: ls -d / >/dev/null
state: absent state: absent
- name: Schedule a command to execute in 20 minutes making sure it is unique in the queue - name: Schedule a command to execute in 20 minutes making sure it is unique in the queue
at: ansible.posix.at:
command: ls -d / >/dev/null command: ls -d / >/dev/null
count: 20 count: 20
units: minutes units: minutes

View file

@ -86,19 +86,19 @@ author: Ansible Core Team
EXAMPLES = r''' EXAMPLES = r'''
- name: Set authorized key taken from file - name: Set authorized key taken from file
authorized_key: ansible.posix.authorized_key:
user: charlie user: charlie
state: present state: present
key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
- name: Set authorized keys taken from url - name: Set authorized keys taken from url
authorized_key: ansible.posix.authorized_key:
user: charlie user: charlie
state: present state: present
key: https://github.com/charlie.keys key: https://github.com/charlie.keys
- name: Set authorized key in alternate location - name: Set authorized key in alternate location
authorized_key: ansible.posix.authorized_key:
user: charlie user: charlie
state: present state: present
key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
@ -106,7 +106,7 @@ EXAMPLES = r'''
manage_dir: False manage_dir: False
- name: Set up multiple authorized keys - name: Set up multiple authorized keys
authorized_key: ansible.posix.authorized_key:
user: deploy user: deploy
state: present state: present
key: '{{ item }}' key: '{{ item }}'
@ -115,28 +115,28 @@ EXAMPLES = r'''
- public_keys/doe-john - public_keys/doe-john
- name: Set authorized key defining key options - name: Set authorized key defining key options
authorized_key: ansible.posix.authorized_key:
user: charlie user: charlie
state: present state: present
key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
key_options: 'no-port-forwarding,from="10.0.1.1"' key_options: 'no-port-forwarding,from="10.0.1.1"'
- name: Set authorized key without validating the TLS/SSL certificates - name: Set authorized key without validating the TLS/SSL certificates
authorized_key: ansible.posix.authorized_key:
user: charlie user: charlie
state: present state: present
key: https://github.com/user.keys key: https://github.com/user.keys
validate_certs: False validate_certs: False
- name: Set authorized key, removing all the authorized keys already set - name: Set authorized key, removing all the authorized keys already set
authorized_key: ansible.posix.authorized_key:
user: root user: root
key: "{{ lookup('file', 'public_keys/doe-jane') }}" key: "{{ lookup('file', 'public_keys/doe-jane') }}"
state: present state: present
exclusive: True exclusive: True
- name: Set authorized key for user ubuntu copying it from current user - name: Set authorized key for user ubuntu copying it from current user
authorized_key: ansible.posix.authorized_key:
user: ubuntu user: ubuntu
state: present state: present
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}" key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"

View file

@ -115,7 +115,7 @@ notes:
EXAMPLES = r''' EXAMPLES = r'''
# Before 2.3, option 'name' was used instead of 'path' # Before 2.3, option 'name' was used instead of 'path'
- name: Mount DVD read-only - name: Mount DVD read-only
mount: ansible.posix.mount:
path: /mnt/dvd path: /mnt/dvd
src: /dev/sr0 src: /dev/sr0
fstype: iso9660 fstype: iso9660
@ -123,14 +123,14 @@ EXAMPLES = r'''
state: present state: present
- name: Mount up device by label - name: Mount up device by label
mount: ansible.posix.mount:
path: /srv/disk path: /srv/disk
src: LABEL=SOME_LABEL src: LABEL=SOME_LABEL
fstype: ext4 fstype: ext4
state: present state: present
- name: Mount up device by UUID - name: Mount up device by UUID
mount: ansible.posix.mount:
path: /home path: /home
src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077 src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
fstype: xfs fstype: xfs
@ -138,12 +138,12 @@ EXAMPLES = r'''
state: present state: present
- name: Unmount a mounted volume - name: Unmount a mounted volume
mount: ansible.posix.mount:
path: /tmp/mnt-pnt path: /tmp/mnt-pnt
state: unmounted state: unmounted
- name: Remount a mounted volume - name: Remount a mounted volume
mount: ansible.posix.mount:
path: /tmp/mnt-pnt path: /tmp/mnt-pnt
state: remounted state: remounted
@ -151,13 +151,13 @@ EXAMPLES = r'''
# a reboot, or until calling "state: unmounted" followed by "state: mounted" # a reboot, or until calling "state: unmounted" followed by "state: mounted"
# on the same "path" # on the same "path"
- name: Remount a mounted volume and append exec to the existing options - name: Remount a mounted volume and append exec to the existing options
mount: ansible.posix.mount:
path: /tmp path: /tmp
state: remounted state: remounted
opts: exec opts: exec
- name: Mount and bind a volume - name: Mount and bind a volume
mount: ansible.posix.mount:
path: /system/new_volume/boot path: /system/new_volume/boot
src: /boot src: /boot
opts: bind opts: bind
@ -165,7 +165,7 @@ EXAMPLES = r'''
fstype: none fstype: none
- name: Mount an NFS volume - name: Mount an NFS volume
mount: ansible.posix.mount:
src: 192.168.1.100:/nfs/ssd/shared_data src: 192.168.1.100:/nfs/ssd/shared_data
path: /mnt/shared_data path: /mnt/shared_data
opts: rw,sync,hard,intr opts: rw,sync,hard,intr

View file

@ -82,18 +82,18 @@ notes:
EXAMPLES = r''' EXAMPLES = r'''
- name: Apply patch to one file - name: Apply patch to one file
patch: ansible.posix.patch:
src: /tmp/index.html.patch src: /tmp/index.html.patch
dest: /var/www/index.html dest: /var/www/index.html
- name: Apply patch to multiple files under basedir - name: Apply patch to multiple files under basedir
patch: ansible.posix.patch:
src: /tmp/customize.patch src: /tmp/customize.patch
basedir: /var/www basedir: /var/www
strip: 1 strip: 1
- name: Revert patch to one file - name: Revert patch to one file
patch: ansible.posix.patch:
src: /tmp/index.html.patch src: /tmp/index.html.patch
dest: /var/www/index.html dest: /var/www/index.html
state: absent state: absent

View file

@ -45,9 +45,9 @@ author:
- Stephen Fromm (@sfromm) - Stephen Fromm (@sfromm)
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Set httpd_can_network_connect flag on and keep it persistent across reboots - name: Set httpd_can_network_connect flag on and keep it persistent across reboots
seboolean: ansible.posix.seboolean:
name: httpd_can_network_connect name: httpd_can_network_connect
state: yes state: yes
persistent: yes persistent: yes

View file

@ -42,17 +42,17 @@ author:
EXAMPLES = r''' EXAMPLES = r'''
- name: Enable SELinux - name: Enable SELinux
selinux: ansible.posix.selinux:
policy: targeted policy: targeted
state: enforcing state: enforcing
- name: Put SELinux in permissive mode, logging actions that would be blocked. - name: Put SELinux in permissive mode, logging actions that would be blocked.
selinux: ansible.posix.selinux:
policy: targeted policy: targeted
state: permissive state: permissive
- name: Disable SELinux - name: Disable SELinux
selinux: ansible.posix.selinux:
state: disabled state: disabled
''' '''

View file

@ -199,88 +199,88 @@ author:
- Timothy Appnel (@tima) - Timothy Appnel (@tima)
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Synchronization of src on the control machine to dest on the remote hosts - name: Synchronization of src on the control machine to dest on the remote hosts
synchronize: ansible.posix.synchronize:
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
- name: Synchronization using rsync protocol (push) - name: Synchronization using rsync protocol (push)
synchronize: ansible.posix.synchronize:
src: some/relative/path/ src: some/relative/path/
dest: rsync://somehost.com/path/ dest: rsync://somehost.com/path/
- name: Synchronization using rsync protocol (pull) - name: Synchronization using rsync protocol (pull)
synchronize: ansible.posix.synchronize:
mode: pull mode: pull
src: rsync://somehost.com/path/ src: rsync://somehost.com/path/
dest: /some/absolute/path/ dest: /some/absolute/path/
- name: Synchronization using rsync protocol on delegate host (push) - name: Synchronization using rsync protocol on delegate host (push)
synchronize: ansible.posix.synchronize:
src: /some/absolute/path/ src: /some/absolute/path/
dest: rsync://somehost.com/path/ dest: rsync://somehost.com/path/
delegate_to: delegate.host delegate_to: delegate.host
- name: Synchronization using rsync protocol on delegate host (pull) - name: Synchronization using rsync protocol on delegate host (pull)
synchronize: ansible.posix.synchronize:
mode: pull mode: pull
src: rsync://somehost.com/path/ src: rsync://somehost.com/path/
dest: /some/absolute/path/ dest: /some/absolute/path/
delegate_to: delegate.host delegate_to: delegate.host
- name: Synchronization without any --archive options enabled - name: Synchronization without any --archive options enabled
synchronize: ansible.posix.synchronize:
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
archive: no archive: no
- name: Synchronization with --archive options enabled except for --recursive - name: Synchronization with --archive options enabled except for --recursive
synchronize: ansible.posix.synchronize:
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
recursive: no recursive: no
- name: Synchronization with --archive options enabled except for --times, with --checksum option enabled - name: Synchronization with --archive options enabled except for --times, with --checksum option enabled
synchronize: ansible.posix.synchronize:
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
checksum: yes checksum: yes
times: no times: no
- name: Synchronization without --archive options enabled except use --links - name: Synchronization without --archive options enabled except use --links
synchronize: ansible.posix.synchronize:
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
archive: no archive: no
links: yes links: yes
- name: Synchronization of two paths both on the control machine - name: Synchronization of two paths both on the control machine
synchronize: ansible.posix.synchronize:
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
delegate_to: localhost delegate_to: localhost
- name: Synchronization of src on the inventory host to the dest on the localhost in pull mode - name: Synchronization of src on the inventory host to the dest on the localhost in pull mode
synchronize: ansible.posix.synchronize:
mode: pull mode: pull
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
- name: Synchronization of src on delegate host to dest on the current inventory host. - name: Synchronization of src on delegate host to dest on the current inventory host.
synchronize: ansible.posix.synchronize:
src: /first/absolute/path src: /first/absolute/path
dest: /second/absolute/path dest: /second/absolute/path
delegate_to: delegate.host delegate_to: delegate.host
- name: Synchronize two directories on one remote host. - name: Synchronize two directories on one remote host.
synchronize: ansible.posix.synchronize:
src: /first/absolute/path src: /first/absolute/path
dest: /second/absolute/path dest: /second/absolute/path
delegate_to: "{{ inventory_hostname }}" delegate_to: "{{ inventory_hostname }}"
- name: Synchronize and delete files in dest on the remote host that are not found in src of localhost. - name: Synchronize and delete files in dest on the remote host that are not found in src of localhost.
synchronize: ansible.posix.synchronize:
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
delete: yes delete: yes
@ -288,7 +288,7 @@ EXAMPLES = '''
# This specific command is granted su privileges on the destination # This specific command is granted su privileges on the destination
- name: Synchronize using an alternate rsync command - name: Synchronize using an alternate rsync command
synchronize: ansible.posix.synchronize:
src: some/relative/path src: some/relative/path
dest: /some/absolute/path dest: /some/absolute/path
rsync_path: su -c rsync rsync_path: su -c rsync
@ -299,7 +299,7 @@ EXAMPLES = '''
# + /var/conf # include /var/conf even though it was previously excluded # + /var/conf # include /var/conf even though it was previously excluded
- name: Synchronize passing in extra rsync options - name: Synchronize passing in extra rsync options
synchronize: ansible.posix.synchronize:
src: /tmp/helloworld src: /tmp/helloworld
dest: /var/www/helloworld dest: /var/www/helloworld
rsync_opts: rsync_opts:
@ -308,7 +308,7 @@ EXAMPLES = '''
# Hardlink files if they didn't change # Hardlink files if they didn't change
- name: Use hardlinks when synchronizing filesystems - name: Use hardlinks when synchronizing filesystems
synchronize: ansible.posix.synchronize:
src: /tmp/path_a/foo.txt src: /tmp/path_a/foo.txt
dest: /tmp/path_b/foo.txt dest: /tmp/path_b/foo.txt
link_dest: /tmp/path_a/ link_dest: /tmp/path_a/
@ -320,7 +320,7 @@ EXAMPLES = '''
tasks: tasks:
- name: copy /tmp/localpath/ to remote location /tmp/remotepath - name: copy /tmp/localpath/ to remote location /tmp/remotepath
synchronize: ansible.posix.synchronize:
src: /tmp/localpath/ src: /tmp/localpath/
dest: /tmp/remotepath dest: /tmp/remotepath
rsync_path: /usr/gnu/bin/rsync rsync_path: /usr/gnu/bin/rsync

View file

@ -59,34 +59,34 @@ options:
author: "David CHANIAL (@davixx) <david.chanial@gmail.com>" author: "David CHANIAL (@davixx) <david.chanial@gmail.com>"
''' '''
EXAMPLES = ''' EXAMPLES = r'''
# Set vm.swappiness to 5 in /etc/sysctl.conf # Set vm.swappiness to 5 in /etc/sysctl.conf
- sysctl: - ansible.posix.sysctl:
name: vm.swappiness name: vm.swappiness
value: '5' value: '5'
state: present state: present
# Remove kernel.panic entry from /etc/sysctl.conf # Remove kernel.panic entry from /etc/sysctl.conf
- sysctl: - ansible.posix.sysctl:
name: kernel.panic name: kernel.panic
state: absent state: absent
sysctl_file: /etc/sysctl.conf sysctl_file: /etc/sysctl.conf
# Set kernel.panic to 3 in /tmp/test_sysctl.conf # Set kernel.panic to 3 in /tmp/test_sysctl.conf
- sysctl: - ansible.posix.sysctl:
name: kernel.panic name: kernel.panic
value: '3' value: '3'
sysctl_file: /tmp/test_sysctl.conf sysctl_file: /tmp/test_sysctl.conf
reload: no reload: no
# Set ip forwarding on in /proc and verify token value with the sysctl command # Set ip forwarding on in /proc and verify token value with the sysctl command
- sysctl: - ansible.posix.sysctl:
name: net.ipv4.ip_forward name: net.ipv4.ip_forward
value: '1' value: '1'
sysctl_set: yes sysctl_set: yes
# Set ip forwarding on in /proc and in the sysctl file and reload if necessary # Set ip forwarding on in /proc and in the sysctl file and reload if necessary
- sysctl: - ansible.posix.sysctl:
name: net.ipv4.ip_forward name: net.ipv4.ip_forward
value: '1' value: '1'
sysctl_set: yes sysctl_set: yes