mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 07:05:27 +01:00
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:
parent
147caed10d
commit
d9e0140b66
9 changed files with 58 additions and 58 deletions
|
|
@ -88,7 +88,7 @@ notes:
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Grant user Joe read access to a file
|
||||
acl:
|
||||
ansible.posix.acl:
|
||||
path: /etc/foo.conf
|
||||
entity: joe
|
||||
etype: user
|
||||
|
|
@ -96,14 +96,14 @@ EXAMPLES = r'''
|
|||
state: present
|
||||
|
||||
- name: Removes the ACL for Joe on a specific file
|
||||
acl:
|
||||
ansible.posix.acl:
|
||||
path: /etc/foo.conf
|
||||
entity: joe
|
||||
etype: user
|
||||
state: absent
|
||||
|
||||
- name: Sets default ACL for joe on /etc/foo.d/
|
||||
acl:
|
||||
ansible.posix.acl:
|
||||
path: /etc/foo.d/
|
||||
entity: joe
|
||||
etype: user
|
||||
|
|
@ -112,13 +112,13 @@ EXAMPLES = r'''
|
|||
state: present
|
||||
|
||||
- name: Same as previous but using entry shorthand
|
||||
acl:
|
||||
ansible.posix.acl:
|
||||
path: /etc/foo.d/
|
||||
entry: default:user:joe:rw-
|
||||
state: present
|
||||
|
||||
- name: Obtain the ACL for a specific file
|
||||
acl:
|
||||
ansible.posix.acl:
|
||||
path: /etc/foo.conf
|
||||
register: acl_info
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -55,20 +55,20 @@ author:
|
|||
- Richard Isaacson (@risaacson)
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r'''
|
||||
- name: Schedule a command to execute in 20 minutes as root
|
||||
at:
|
||||
ansible.posix.at:
|
||||
command: ls -d / >/dev/null
|
||||
count: 20
|
||||
units: minutes
|
||||
|
||||
- name: Match a command to an existing job and delete the job
|
||||
at:
|
||||
ansible.posix.at:
|
||||
command: ls -d / >/dev/null
|
||||
state: absent
|
||||
|
||||
- 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
|
||||
count: 20
|
||||
units: minutes
|
||||
|
|
|
|||
|
|
@ -86,19 +86,19 @@ author: Ansible Core Team
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Set authorized key taken from file
|
||||
authorized_key:
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
state: present
|
||||
key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
|
||||
|
||||
- name: Set authorized keys taken from url
|
||||
authorized_key:
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
state: present
|
||||
key: https://github.com/charlie.keys
|
||||
|
||||
- name: Set authorized key in alternate location
|
||||
authorized_key:
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
state: present
|
||||
key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
|
||||
|
|
@ -106,7 +106,7 @@ EXAMPLES = r'''
|
|||
manage_dir: False
|
||||
|
||||
- name: Set up multiple authorized keys
|
||||
authorized_key:
|
||||
ansible.posix.authorized_key:
|
||||
user: deploy
|
||||
state: present
|
||||
key: '{{ item }}'
|
||||
|
|
@ -115,28 +115,28 @@ EXAMPLES = r'''
|
|||
- public_keys/doe-john
|
||||
|
||||
- name: Set authorized key defining key options
|
||||
authorized_key:
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
state: present
|
||||
key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
|
||||
key_options: 'no-port-forwarding,from="10.0.1.1"'
|
||||
|
||||
- name: Set authorized key without validating the TLS/SSL certificates
|
||||
authorized_key:
|
||||
ansible.posix.authorized_key:
|
||||
user: charlie
|
||||
state: present
|
||||
key: https://github.com/user.keys
|
||||
validate_certs: False
|
||||
|
||||
- name: Set authorized key, removing all the authorized keys already set
|
||||
authorized_key:
|
||||
ansible.posix.authorized_key:
|
||||
user: root
|
||||
key: "{{ lookup('file', 'public_keys/doe-jane') }}"
|
||||
state: present
|
||||
exclusive: True
|
||||
|
||||
- name: Set authorized key for user ubuntu copying it from current user
|
||||
authorized_key:
|
||||
ansible.posix.authorized_key:
|
||||
user: ubuntu
|
||||
state: present
|
||||
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ notes:
|
|||
EXAMPLES = r'''
|
||||
# Before 2.3, option 'name' was used instead of 'path'
|
||||
- name: Mount DVD read-only
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
path: /mnt/dvd
|
||||
src: /dev/sr0
|
||||
fstype: iso9660
|
||||
|
|
@ -123,14 +123,14 @@ EXAMPLES = r'''
|
|||
state: present
|
||||
|
||||
- name: Mount up device by label
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
path: /srv/disk
|
||||
src: LABEL=SOME_LABEL
|
||||
fstype: ext4
|
||||
state: present
|
||||
|
||||
- name: Mount up device by UUID
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
path: /home
|
||||
src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077
|
||||
fstype: xfs
|
||||
|
|
@ -138,12 +138,12 @@ EXAMPLES = r'''
|
|||
state: present
|
||||
|
||||
- name: Unmount a mounted volume
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
path: /tmp/mnt-pnt
|
||||
state: unmounted
|
||||
|
||||
- name: Remount a mounted volume
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
path: /tmp/mnt-pnt
|
||||
state: remounted
|
||||
|
||||
|
|
@ -151,13 +151,13 @@ EXAMPLES = r'''
|
|||
# a reboot, or until calling "state: unmounted" followed by "state: mounted"
|
||||
# on the same "path"
|
||||
- name: Remount a mounted volume and append exec to the existing options
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
path: /tmp
|
||||
state: remounted
|
||||
opts: exec
|
||||
|
||||
- name: Mount and bind a volume
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
path: /system/new_volume/boot
|
||||
src: /boot
|
||||
opts: bind
|
||||
|
|
@ -165,7 +165,7 @@ EXAMPLES = r'''
|
|||
fstype: none
|
||||
|
||||
- name: Mount an NFS volume
|
||||
mount:
|
||||
ansible.posix.mount:
|
||||
src: 192.168.1.100:/nfs/ssd/shared_data
|
||||
path: /mnt/shared_data
|
||||
opts: rw,sync,hard,intr
|
||||
|
|
|
|||
|
|
@ -82,18 +82,18 @@ notes:
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Apply patch to one file
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: /tmp/index.html.patch
|
||||
dest: /var/www/index.html
|
||||
|
||||
- name: Apply patch to multiple files under basedir
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: /tmp/customize.patch
|
||||
basedir: /var/www
|
||||
strip: 1
|
||||
|
||||
- name: Revert patch to one file
|
||||
patch:
|
||||
ansible.posix.patch:
|
||||
src: /tmp/index.html.patch
|
||||
dest: /var/www/index.html
|
||||
state: absent
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ author:
|
|||
- Stephen Fromm (@sfromm)
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r'''
|
||||
- name: Set httpd_can_network_connect flag on and keep it persistent across reboots
|
||||
seboolean:
|
||||
ansible.posix.seboolean:
|
||||
name: httpd_can_network_connect
|
||||
state: yes
|
||||
persistent: yes
|
||||
|
|
|
|||
|
|
@ -42,17 +42,17 @@ author:
|
|||
|
||||
EXAMPLES = r'''
|
||||
- name: Enable SELinux
|
||||
selinux:
|
||||
ansible.posix.selinux:
|
||||
policy: targeted
|
||||
state: enforcing
|
||||
|
||||
- name: Put SELinux in permissive mode, logging actions that would be blocked.
|
||||
selinux:
|
||||
ansible.posix.selinux:
|
||||
policy: targeted
|
||||
state: permissive
|
||||
|
||||
- name: Disable SELinux
|
||||
selinux:
|
||||
ansible.posix.selinux:
|
||||
state: disabled
|
||||
'''
|
||||
|
||||
|
|
|
|||
|
|
@ -199,88 +199,88 @@ author:
|
|||
- Timothy Appnel (@tima)
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r'''
|
||||
- name: Synchronization of src on the control machine to dest on the remote hosts
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
|
||||
- name: Synchronization using rsync protocol (push)
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path/
|
||||
dest: rsync://somehost.com/path/
|
||||
|
||||
- name: Synchronization using rsync protocol (pull)
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
mode: pull
|
||||
src: rsync://somehost.com/path/
|
||||
dest: /some/absolute/path/
|
||||
|
||||
- name: Synchronization using rsync protocol on delegate host (push)
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: /some/absolute/path/
|
||||
dest: rsync://somehost.com/path/
|
||||
delegate_to: delegate.host
|
||||
|
||||
- name: Synchronization using rsync protocol on delegate host (pull)
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
mode: pull
|
||||
src: rsync://somehost.com/path/
|
||||
dest: /some/absolute/path/
|
||||
delegate_to: delegate.host
|
||||
|
||||
- name: Synchronization without any --archive options enabled
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
archive: no
|
||||
|
||||
- name: Synchronization with --archive options enabled except for --recursive
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
recursive: no
|
||||
|
||||
- name: Synchronization with --archive options enabled except for --times, with --checksum option enabled
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
checksum: yes
|
||||
times: no
|
||||
|
||||
- name: Synchronization without --archive options enabled except use --links
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
archive: no
|
||||
links: yes
|
||||
|
||||
- name: Synchronization of two paths both on the control machine
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Synchronization of src on the inventory host to the dest on the localhost in pull mode
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
mode: pull
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
|
||||
- name: Synchronization of src on delegate host to dest on the current inventory host.
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: /first/absolute/path
|
||||
dest: /second/absolute/path
|
||||
delegate_to: delegate.host
|
||||
|
||||
- name: Synchronize two directories on one remote host.
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: /first/absolute/path
|
||||
dest: /second/absolute/path
|
||||
delegate_to: "{{ inventory_hostname }}"
|
||||
|
||||
- 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
|
||||
dest: /some/absolute/path
|
||||
delete: yes
|
||||
|
|
@ -288,7 +288,7 @@ EXAMPLES = '''
|
|||
|
||||
# This specific command is granted su privileges on the destination
|
||||
- name: Synchronize using an alternate rsync command
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: some/relative/path
|
||||
dest: /some/absolute/path
|
||||
rsync_path: su -c rsync
|
||||
|
|
@ -299,7 +299,7 @@ EXAMPLES = '''
|
|||
# + /var/conf # include /var/conf even though it was previously excluded
|
||||
|
||||
- name: Synchronize passing in extra rsync options
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: /tmp/helloworld
|
||||
dest: /var/www/helloworld
|
||||
rsync_opts:
|
||||
|
|
@ -308,7 +308,7 @@ EXAMPLES = '''
|
|||
|
||||
# Hardlink files if they didn't change
|
||||
- name: Use hardlinks when synchronizing filesystems
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: /tmp/path_a/foo.txt
|
||||
dest: /tmp/path_b/foo.txt
|
||||
link_dest: /tmp/path_a/
|
||||
|
|
@ -320,7 +320,7 @@ EXAMPLES = '''
|
|||
|
||||
tasks:
|
||||
- name: copy /tmp/localpath/ to remote location /tmp/remotepath
|
||||
synchronize:
|
||||
ansible.posix.synchronize:
|
||||
src: /tmp/localpath/
|
||||
dest: /tmp/remotepath
|
||||
rsync_path: /usr/gnu/bin/rsync
|
||||
|
|
|
|||
|
|
@ -59,34 +59,34 @@ options:
|
|||
author: "David CHANIAL (@davixx) <david.chanial@gmail.com>"
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r'''
|
||||
# Set vm.swappiness to 5 in /etc/sysctl.conf
|
||||
- sysctl:
|
||||
- ansible.posix.sysctl:
|
||||
name: vm.swappiness
|
||||
value: '5'
|
||||
state: present
|
||||
|
||||
# Remove kernel.panic entry from /etc/sysctl.conf
|
||||
- sysctl:
|
||||
- ansible.posix.sysctl:
|
||||
name: kernel.panic
|
||||
state: absent
|
||||
sysctl_file: /etc/sysctl.conf
|
||||
|
||||
# Set kernel.panic to 3 in /tmp/test_sysctl.conf
|
||||
- sysctl:
|
||||
- ansible.posix.sysctl:
|
||||
name: kernel.panic
|
||||
value: '3'
|
||||
sysctl_file: /tmp/test_sysctl.conf
|
||||
reload: no
|
||||
|
||||
# Set ip forwarding on in /proc and verify token value with the sysctl command
|
||||
- sysctl:
|
||||
- ansible.posix.sysctl:
|
||||
name: net.ipv4.ip_forward
|
||||
value: '1'
|
||||
sysctl_set: yes
|
||||
|
||||
# Set ip forwarding on in /proc and in the sysctl file and reload if necessary
|
||||
- sysctl:
|
||||
- ansible.posix.sysctl:
|
||||
name: net.ipv4.ip_forward
|
||||
value: '1'
|
||||
sysctl_set: yes
|
||||
|
|
|
|||
Loading…
Reference in a new issue