From 9a09d7eb078f92521a38889fc89ac5b204d32ce1 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Wed, 17 Jun 2020 16:05:33 +0530 Subject: [PATCH] Update docs Signed-off-by: Abhijeet Kasurde --- README.md | 16 +- docs/ansible.posix.acl.rst | 348 +++++++++++++ docs/ansible.posix.at.rst | 193 +++++++ docs/ansible.posix.authorized_key.rst | 479 +++++++++++++++++ docs/ansible.posix.mount.rst | 315 ++++++++++++ docs/ansible.posix.patch.rst | 232 +++++++++ docs/ansible.posix.seboolean.rst | 155 ++++++ docs/ansible.posix.selinux.rst | 238 +++++++++ docs/ansible.posix.synchronize.rst | 705 ++++++++++++++++++++++++++ docs/ansible.posix.sysctl.rst | 221 ++++++++ 10 files changed, 2900 insertions(+), 2 deletions(-) create mode 100644 docs/ansible.posix.acl.rst create mode 100644 docs/ansible.posix.at.rst create mode 100644 docs/ansible.posix.authorized_key.rst create mode 100644 docs/ansible.posix.mount.rst create mode 100644 docs/ansible.posix.patch.rst create mode 100644 docs/ansible.posix.seboolean.rst create mode 100644 docs/ansible.posix.selinux.rst create mode 100644 docs/ansible.posix.synchronize.rst create mode 100644 docs/ansible.posix.sysctl.rst diff --git a/README.md b/README.md index ee727f3..8b1362b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,20 @@ None ## Included content - + +### Modules +Name | Description +--- | --- +[ansible.posix.acl](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.acl.rst)|Set and retrieve file ACL information. +[ansible.posix.at](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.at.rst)|Schedule the execution of a command or script file via the at command +[ansible.posix.authorized_key](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.authorized_key.rst)|Adds or removes an SSH authorized key +[ansible.posix.mount](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.mount.rst)|Control active and configured mount points +[ansible.posix.patch](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.patch.rst)|Apply patch files using the GNU patch tool +[ansible.posix.seboolean](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.seboolean.rst)|Toggles SELinux booleans +[ansible.posix.selinux](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.selinux.rst)|Change policy and state of SELinux +[ansible.posix.synchronize](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.synchronize.rst)|A wrapper around rsync to make common tasks in your playbooks quick and easy +[ansible.posix.sysctl](https://github.com/ansible-collections/ansible.posix/blob/master/docs/ansible.posix.sysctl.rst)|Manage entries in sysctl.conf. + ## Using this collection @@ -55,4 +68,3 @@ See [Ansible Using collections](https://docs.ansible.com/ansible/latest/user_gui GNU General Public License v3.0 or later. See [LICENCE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. - diff --git a/docs/ansible.posix.acl.rst b/docs/ansible.posix.acl.rst new file mode 100644 index 0000000..fc61e86 --- /dev/null +++ b/docs/ansible.posix.acl.rst @@ -0,0 +1,348 @@ +:orphan: + +.. _ansible.posix.acl_module: + + +***************** +ansible.posix.acl +***************** + +**Set and retrieve file ACL information.** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Set and retrieve file ACL information. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ default + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
If the target is a directory, setting this to yes will make it the default ACL for entities created inside the directory.
+
Setting default to yes causes an error if the path is a file.
+
+
+ entity + +
+ - +
+
+ +
The actual user or group that the ACL applies to when matching entity types user or group are selected.
+
+
+ entry + +
+ - +
+
+ +
DEPRECATED.
+
The ACL to set or remove.
+
This must always be quoted in the form of <etype>:<qualifier>:<perms>.
+
The qualifier may be empty for some types, but the type and perms are always required.
+
- can be used as placeholder when you do not care about permissions.
+
This is now superseded by entity, type and permissions fields.
+
+
+ etype + +
+ - +
+
+
    Choices: +
  • group
  • +
  • mask
  • +
  • other
  • +
  • user
  • +
+
+
The entity type of the ACL to apply, see setfacl documentation for more info.
+
+
+ follow + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Whether to follow symlinks on the path if a symlink is encountered.
+
+
+ path + +
+ path + / required
+
+ +
The full path of the file or object.
+

aliases: name
+
+
+ permissions + +
+ - +
+
+ +
The permissions to apply/remove can be any combination of r, w and x (read, write and execute respectively)
+
+
+ recalculate_mask + +
+ - +
+
+
    Choices: +
  • default ←
  • +
  • mask
  • +
  • no_mask
  • +
+
+
Select if and when to recalculate the effective right masks of the files.
+
See setfacl documentation for more info.
+
Incompatible with state=query.
+
+
+ recursive + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Recursively sets the specified ACL.
+
Incompatible with state=query.
+
+
+ state + +
+ - +
+
+
    Choices: +
  • absent
  • +
  • present
  • +
  • query ←
  • +
+
+
Define whether the ACL should be present or not.
+
The query state gets the current ACL without changing it, for use in register operations.
+
+
+ use_nfsv4_acls + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Use NFSv4 ACLs instead of POSIX ACLs.
+
+
+ + +Notes +----- + +.. note:: + - The ``acl`` module requires that ACLs are enabled on the target filesystem and that the ``setfacl`` and ``getfacl`` binaries are installed. + - As of Ansible 2.0, this module only supports Linux distributions. + - As of Ansible 2.3, the *name* option has been changed to *path* as default, but *name* still works as well. + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Grant user Joe read access to a file + ansible.posix.acl: + path: /etc/foo.conf + entity: joe + etype: user + permissions: r + state: present + + - name: Removes the ACL for Joe on a specific file + ansible.posix.acl: + path: /etc/foo.conf + entity: joe + etype: user + state: absent + + - name: Sets default ACL for joe on /etc/foo.d/ + ansible.posix.acl: + path: /etc/foo.d/ + entity: joe + etype: user + permissions: rw + default: yes + state: present + + - name: Same as previous but using entry shorthand + ansible.posix.acl: + path: /etc/foo.d/ + entry: default:user:joe:rw- + state: present + + - name: Obtain the ACL for a specific file + ansible.posix.acl: + path: /etc/foo.conf + register: acl_info + + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ acl + +
+ list +
+
success +
Current ACL on provided path (after changes, if any)
+
+
Sample:
+
['user::rwx', 'group::rwx', 'other::rwx']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Brian Coca (@bcoca) +- Jérémie Astori (@astorije) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/docs/ansible.posix.at.rst b/docs/ansible.posix.at.rst new file mode 100644 index 0000000..fcd15e6 --- /dev/null +++ b/docs/ansible.posix.at.rst @@ -0,0 +1,193 @@ +:orphan: + +.. _ansible.posix.at_module: + + +**************** +ansible.posix.at +**************** + +**Schedule the execution of a command or script file via the at command** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Use this module to schedule a command or script file to run once in the future. +- All jobs are executed in the 'a' queue. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- at + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ command + +
+ string +
+
+ +
A command to be executed in the future.
+
+
+ count + +
+ integer + / required
+
+ +
The count of units in the future to execute the command or script file.
+
+
+ script_file + +
+ string +
+
+ +
An existing script file to be executed in the future.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • absent
  • +
  • present ←
  • +
+
+
The state dictates if the command or script file should be evaluated as present(added) or absent(deleted).
+
+
+ unique + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
If a matching job is present a new job will not be added.
+
+
+ units + +
+ string + / required
+
+
    Choices: +
  • minutes
  • +
  • hours
  • +
  • days
  • +
  • weeks
  • +
+
+
The type of units in the future to execute the command or script file.
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Schedule a command to execute in 20 minutes as root + ansible.posix.at: + command: ls -d / >/dev/null + count: 20 + units: minutes + + - name: Match a command to an existing job and delete the job + 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 + ansible.posix.at: + command: ls -d / >/dev/null + count: 20 + units: minutes + unique: yes + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Richard Isaacson (@risaacson) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/docs/ansible.posix.authorized_key.rst b/docs/ansible.posix.authorized_key.rst new file mode 100644 index 0000000..50349c5 --- /dev/null +++ b/docs/ansible.posix.authorized_key.rst @@ -0,0 +1,479 @@ +:orphan: + +.. _ansible.posix.authorized_key_module: + + +**************************** +ansible.posix.authorized_key +**************************** + +**Adds or removes an SSH authorized key** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Adds or removes SSH authorized keys for particular user accounts. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ comment + +
+ string +
+
+ +
Change the comment on the public key.
+
Rewriting the comment is useful in cases such as fetching it from GitHub or GitLab.
+
If no comment is specified, the existing comment will be kept.
+
+
+ exclusive + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Whether to remove all other non-specified keys from the authorized_keys file.
+
Multiple keys can be specified in a single key string value by separating them by newlines.
+
This option is not loop aware, so if you use with_ , it will be exclusive per iteration of the loop.
+
If you want multiple keys in the file you need to pass them all to key in a single batch as mentioned above.
+
+
+ follow + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Follow path symlink instead of replacing it.
+
+
+ key + +
+ string + / required
+
+ +
The SSH public key(s), as a string or (since Ansible 1.9) url (https://github.com/username.keys).
+
+
+ key_options + +
+ - +
+
+ +
A string of ssh key options to be prepended to the key in the authorized_keys file.
+
+
+ manage_dir + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Whether this module should manage the directory of the authorized key file.
+
If set to yes, the module will create the directory, as well as set the owner and permissions of an existing directory.
+
Be sure to set manage_dir=no if you are using an alternate directory for authorized_keys, as set with path, since you could lock yourself out of SSH access.
+
See the example below.
+
+
+ path + +
+ path +
+
+ +
Alternate path to the authorized_keys file.
+
When unset, this value defaults to ~/.ssh/authorized_keys.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • absent
  • +
  • present ←
  • +
+
+
Whether the given key (with the given key_options) should or should not be in the file.
+
+
+ user + +
+ string + / required
+
+ +
The username on the remote host whose authorized_keys file will be modified.
+
+
+ validate_certs + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
This only applies if using a https url as the source of the keys.
+
If set to no, the SSL certificates will not be validated.
+
This should only set to no used on personally controlled sites using self-signed certificates as it avoids verifying the source site.
+
Prior to 2.1 the code worked as if this was set to yes.
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Set authorized key taken from file + ansible.posix.authorized_key: + user: charlie + state: present + key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" + + - name: Set authorized keys taken from url + ansible.posix.authorized_key: + user: charlie + state: present + key: https://github.com/charlie.keys + + - name: Set authorized key in alternate location + ansible.posix.authorized_key: + user: charlie + state: present + key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}" + path: /etc/ssh/authorized_keys/charlie + manage_dir: False + + - name: Set up multiple authorized keys + ansible.posix.authorized_key: + user: deploy + state: present + key: '{{ item }}' + with_file: + - public_keys/doe-jane + - public_keys/doe-john + + - name: Set authorized key defining key options + 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 + 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 + 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 + ansible.posix.authorized_key: + user: ubuntu + state: present + key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}" + + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ exclusive + +
+ boolean +
+
success +
If the key has been forced to be exclusive or not.
+
+
+
+ key + +
+ string +
+
success +
The key that the module was running against.
+
+
Sample:
+
https://github.com/user.keys
+
+
+ key_option + +
+ string +
+
success +
Key options related to the key.
+
+
+
+ keyfile + +
+ string +
+
success +
Path for authorized key file.
+
+
Sample:
+
/home/user/.ssh/authorized_keys
+
+
+ manage_dir + +
+ boolean +
+
success +
Whether this module managed the directory of the authorized key file.
+
+
Sample:
+
True
+
+
+ path + +
+ string +
+
success +
Alternate path to the authorized_keys file
+
+
+
+ state + +
+ string +
+
success +
Whether the given key (with the given key_options) should or should not be in the file
+
+
Sample:
+
present
+
+
+ unique + +
+ boolean +
+
success +
Whether the key is unique
+
+
+
+ user + +
+ string +
+
success +
The username on the remote host whose authorized_keys file will be modified
+
+
Sample:
+
user
+
+
+ validate_certs + +
+ boolean +
+
success +
This only applies if using a https url as the source of the keys. If set to no, the SSL certificates will not be validated.
+
+
Sample:
+
True
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Core Team + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/docs/ansible.posix.mount.rst b/docs/ansible.posix.mount.rst new file mode 100644 index 0000000..2cba389 --- /dev/null +++ b/docs/ansible.posix.mount.rst @@ -0,0 +1,315 @@ +:orphan: + +.. _ansible.posix.mount_module: + + +******************* +ansible.posix.mount +******************* + +**Control active and configured mount points** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module controls active and configured mount points in ``/etc/fstab``. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ backup + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
+
+
+ boot + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Determines if the filesystem should be mounted on boot.
+
Only applies to Solaris systems.
+
+
+ dump + +
+ string +
+
+ Default:
0
+
+
Dump (see fstab(5)).
+
Note that if set to null and state set to present, it will cease to work and duplicate entries will be made with subsequent runs.
+
Has no effect on Solaris systems.
+
+
+ fstab + +
+ string +
+
+ +
File to use instead of /etc/fstab.
+
You should not use this option unless you really know what you are doing.
+
This might be useful if you need to configure mountpoints in a chroot environment.
+
OpenBSD does not allow specifying alternate fstab files with mount so do not use this on OpenBSD with any state that operates on the live filesystem.
+
This parameter defaults to /etc/fstab or /etc/vfstab on Solaris.
+
+
+ fstype + +
+ string +
+
+ +
Filesystem type.
+
Required when state is present or mounted.
+
+
+ opts + +
+ string +
+
+ +
Mount options (see fstab(5), or vfstab(4) on Solaris).
+
+
+ passno + +
+ string +
+
+ Default:
0
+
+
Passno (see fstab(5)).
+
Note that if set to null and state set to present, it will cease to work and duplicate entries will be made with subsequent runs.
+
Deprecated on Solaris systems.
+
+
+ path + +
+ path + / required
+
+ +
Path to the mount point (e.g. /mnt/files).
+
Before Ansible 2.3 this option was only usable as dest, destfile and name.
+

aliases: name
+
+
+ src + +
+ path +
+
+ +
Device (or NFS volume, or something else) to be mounted on path.
+
Required when state set to present or mounted.
+
+
+ state + +
+ string + / required
+
+
    Choices: +
  • absent
  • +
  • mounted
  • +
  • present
  • +
  • unmounted
  • +
  • remounted
  • +
+
+
If mounted, the device will be actively mounted and appropriately configured in fstab. If the mount point is not present, the mount point will be created.
+
If unmounted, the device will be unmounted without changing fstab.
+
present only specifies that the device is to be configured in fstab and does not trigger or require a mount.
+
absent specifies that the device mount's entry will be removed from fstab and will also unmount the device and remove the mount point.
+
remounted specifies that the device will be remounted for when you want to force a refresh on the mount itself (added in 2.9). This will always return changed=true. If opts is set, the options will be applied to the remount, but will not change fstab. Additionally, if opts is set, and the remount command fails, the module will error to prevent unexpected mount changes. Try using mounted instead to work around this issue.
+
+
+ + +Notes +----- + +.. note:: + - As of Ansible 2.3, the *name* option has been changed to *path* as default, but *name* still works as well. + - Using ``remounted`` with *opts* set may create unexpected results based on the existing options already defined on mount, so care should be taken to ensure that conflicting options are not present before hand. + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + # Before 2.3, option 'name' was used instead of 'path' + - name: Mount DVD read-only + ansible.posix.mount: + path: /mnt/dvd + src: /dev/sr0 + fstype: iso9660 + opts: ro,noauto + state: present + + - name: Mount up device by label + ansible.posix.mount: + path: /srv/disk + src: LABEL=SOME_LABEL + fstype: ext4 + state: present + + - name: Mount up device by UUID + ansible.posix.mount: + path: /home + src: UUID=b3e48f45-f933-4c8e-a700-22a159ec9077 + fstype: xfs + opts: noatime + state: present + + - name: Unmount a mounted volume + ansible.posix.mount: + path: /tmp/mnt-pnt + state: unmounted + + - name: Remount a mounted volume + ansible.posix.mount: + path: /tmp/mnt-pnt + state: remounted + + # The following will not save changes to fstab, and only be temporary until + # 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 + ansible.posix.mount: + path: /tmp + state: remounted + opts: exec + + - name: Mount and bind a volume + ansible.posix.mount: + path: /system/new_volume/boot + src: /boot + opts: bind + state: mounted + fstype: none + + - name: Mount an NFS volume + ansible.posix.mount: + src: 192.168.1.100:/nfs/ssd/shared_data + path: /mnt/shared_data + opts: rw,sync,hard,intr + state: mounted + fstype: nfs + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Core Team +- Seth Vidal (@skvidal) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/docs/ansible.posix.patch.rst b/docs/ansible.posix.patch.rst new file mode 100644 index 0000000..ba6600d --- /dev/null +++ b/docs/ansible.posix.patch.rst @@ -0,0 +1,232 @@ +:orphan: + +.. _ansible.posix.patch_module: + + +******************* +ansible.posix.patch +******************* + +**Apply patch files using the GNU patch tool** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Apply patch files using the GNU patch tool. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ backup + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Passes --backup --version-control=numbered to patch, producing numbered backup copies.
+
+
+ basedir + +
+ path +
+
+ +
Path of a base directory in which the patch file will be applied.
+
May be omitted when dest option is specified, otherwise required.
+
+
+ binary + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Setting to yes will disable patch's heuristic for transforming CRLF line endings into LF.
+
Line endings of src and dest must match.
+
If set to no, patch will replace CRLF in src files on POSIX.
+
+
+ dest + +
+ path +
+
+ +
Path of the file on the remote machine to be patched.
+
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can specified with this option.
+

aliases: originalfile
+
+
+ remote_src + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
If no, it will search for src at originating/master machine, if yes it will go to the remote/target machine for the src.
+
+
+ src + +
+ path + / required
+
+ +
Path of the patch file as accepted by the GNU patch tool. If remote_src is 'no', the patch source file is looked up from the module's files directory.
+

aliases: patchfile
+
+
+ state + +
+ string +
+
+
    Choices: +
  • absent
  • +
  • present ←
  • +
+
+
Whether the patch should be applied or reverted.
+
+
+ strip + +
+ integer +
+
+ Default:
0
+
+
Number that indicates the smallest prefix containing leading slashes that will be stripped from each file name found in the patch file.
+
For more information see the strip parameter of the GNU patch tool.
+
+
+ + +Notes +----- + +.. note:: + - This module requires GNU *patch* utility to be installed on the remote host. + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Apply patch to one file + ansible.posix.patch: + src: /tmp/index.html.patch + dest: /var/www/index.html + + - name: Apply patch to multiple files under basedir + ansible.posix.patch: + src: /tmp/customize.patch + basedir: /var/www + strip: 1 + + - name: Revert patch to one file + ansible.posix.patch: + src: /tmp/index.html.patch + dest: /var/www/index.html + state: absent + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Jakub Jirutka (@jirutka) +- Luis Alberto Perez Lazaro (@luisperlaz) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/docs/ansible.posix.seboolean.rst b/docs/ansible.posix.seboolean.rst new file mode 100644 index 0000000..7398ed9 --- /dev/null +++ b/docs/ansible.posix.seboolean.rst @@ -0,0 +1,155 @@ +:orphan: + +.. _ansible.posix.seboolean_module: + + +*********************** +ansible.posix.seboolean +*********************** + +**Toggles SELinux booleans** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Toggles SELinux booleans. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- libselinux-python +- libsemanage-python + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ ignore_selinux_state + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Useful for scenarios (chrooted environment) that you can't get the real SELinux state.
+
+
+ name + +
+ - + / required
+
+ +
Name of the boolean to configure.
+
+
+ persistent + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Set to yes if the boolean setting should survive a reboot.
+
+
+ state + +
+ boolean + / required
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Desired boolean value
+
+
+ + +Notes +----- + +.. note:: + - Not tested on any Debian based system. + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Set httpd_can_network_connect flag on and keep it persistent across reboots + ansible.posix.seboolean: + name: httpd_can_network_connect + state: yes + persistent: yes + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Stephen Fromm (@sfromm) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/docs/ansible.posix.selinux.rst b/docs/ansible.posix.selinux.rst new file mode 100644 index 0000000..b00b66a --- /dev/null +++ b/docs/ansible.posix.selinux.rst @@ -0,0 +1,238 @@ +:orphan: + +.. _ansible.posix.selinux_module: + + +********************* +ansible.posix.selinux +********************* + +**Change policy and state of SELinux** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Configures the SELinux mode and policy. +- A reboot may be required after usage. +- Ansible will not issue this reboot but will let you know when it is required. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- libselinux-python + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ configfile + +
+ - +
+
+ Default:
"/etc/selinux/config"
+
+
The path to the SELinux configuration file, if non-standard.
+

aliases: conf, file
+
+
+ policy + +
+ - +
+
+ +
The name of the SELinux policy to use (e.g. targeted) will be required if state is not disabled.
+
+
+ state + +
+ - + / required
+
+
    Choices: +
  • disabled
  • +
  • enforcing
  • +
  • permissive
  • +
+
+
The SELinux mode.
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Enable SELinux + ansible.posix.selinux: + policy: targeted + state: enforcing + + - name: Put SELinux in permissive mode, logging actions that would be blocked. + ansible.posix.selinux: + policy: targeted + state: permissive + + - name: Disable SELinux + ansible.posix.selinux: + state: disabled + + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ configfile + +
+ string +
+
always +
Path to SELinux configuration file.
+
+
Sample:
+
/etc/selinux/config
+
+
+ msg + +
+ string +
+
always +
Messages that describe changes that were made.
+
+
Sample:
+
Config SELinux state changed from 'disabled' to 'permissive'
+
+
+ policy + +
+ string +
+
always +
Name of the SELinux policy.
+
+
Sample:
+
targeted
+
+
+ reboot_required + +
+ boolean +
+
always +
Whether or not an reboot is required for the changes to take effect.
+
+
Sample:
+
True
+
+
+ state + +
+ string +
+
always +
SELinux mode.
+
+
Sample:
+
enforcing
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Derek Carter (@goozbach) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/docs/ansible.posix.synchronize.rst b/docs/ansible.posix.synchronize.rst new file mode 100644 index 0000000..b19a57e --- /dev/null +++ b/docs/ansible.posix.synchronize.rst @@ -0,0 +1,705 @@ +:orphan: + +.. _ansible.posix.synchronize_module: + + +************************* +ansible.posix.synchronize +************************* + +**A wrapper around rsync to make common tasks in your playbooks quick and easy** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- ``synchronize`` is a wrapper around rsync to make common tasks in your playbooks quick and easy. +- It is run and originates on the local host where Ansible is being run. +- Of course, you could just use the ``command`` action to call rsync yourself, but you also have to add a fair number of boilerplate options and host facts. +- This module is not intended to provide access to the full power of rsync, but does make the most common invocations easier to implement. You `still` may need to call rsync directly via ``command`` or ``shell`` depending on your use case. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ archive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D.
+
+
+ checksum + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Skip based on checksum, rather than mod-time & size; Note that that "archive" option is still enabled by default - the "checksum" option will not disable it.
+
+
+ compress + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Compress file data during the transfer.
+
In most cases, leave this enabled unless it causes problems.
+
+
+ copy_links + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Copy symlinks as the item that they point to (the referent) is copied, rather than the symlink.
+
+
+ delete + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Delete files in dest that don't exist (after transfer, not before) in the src path.
+
This option requires recursive=yes.
+
This option ignores excluded files and behaves like the rsync opt --delete-excluded.
+
+
+ dest + +
+ string + / required
+
+ +
Path on the destination host that will be synchronized from the source.
+
The path can be absolute or relative.
+
+
+ dest_port + +
+ integer +
+
+ +
Port number for ssh on the destination host.
+
Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value.
+
This parameter defaults to the value of ansible_ssh_port or ansible_port, the remote_port config setting or the value from ssh client configuration if none of the former have been set.
+
+
+ dirs + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Transfer directories without recursing.
+
+
+ existing_only + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Skip creating new files on receiver.
+
+
+ group + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Preserve group.
+
This parameter defaults to the value of the archive option.
+
+
+ link_dest + +
+ list +
+
+ Default:
null
+
+
Add a destination to hard link against during the rsync.
+
+
+ links + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Copy symlinks as symlinks.
+
This parameter defaults to the value of the archive option.
+
+
+ mode + +
+ string +
+
+
    Choices: +
  • pull
  • +
  • push ←
  • +
+
+
Specify the direction of the synchronization.
+
In push mode the localhost or delegate is the source.
+
In pull mode the remote host in context is the source.
+
+
+ owner + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Preserve owner (super user only).
+
This parameter defaults to the value of the archive option.
+
+
+ partial + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.
+
+
+ perms + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Preserve permissions.
+
This parameter defaults to the value of the archive option.
+
+
+ private_key + +
+ path +
+
+ +
Specify the private key to use for SSH-based rsync connections (e.g. ~/.ssh/id_rsa).
+
+
+ recursive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Recurse into directories.
+
This parameter defaults to the value of the archive option.
+
+
+ rsync_opts + +
+ list +
+
+ Default:
null
+
+
Specify additional rsync options by passing in an array.
+
Note that an empty string in rsync_opts will end up transfer the current working directory.
+
+
+ rsync_path + +
+ string +
+
+ +
Specify the rsync command to run on the remote host. See --rsync-path on the rsync man page.
+
To specify the rsync command to run on the local host, you need to set this your task var ansible_rsync_path.
+
+
+ rsync_timeout + +
+ integer +
+
+ Default:
0
+
+
Specify a --timeout for the rsync command in seconds.
+
+
+ set_remote_user + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Put user@ for the remote paths.
+
If you have a custom ssh config to define the remote user for a host that does not match the inventory user, you should set this parameter to no.
+
+
+ src + +
+ string + / required
+
+ +
Path on the source host that will be synchronized to the destination.
+
The path can be absolute or relative.
+
+
+ times + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Preserve modification times.
+
This parameter defaults to the value of the archive option.
+
+
+ use_ssh_args + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Use the ssh_args specified in ansible.cfg.
+
+
+ verify_host + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Verify destination host key.
+
+
+ + +Notes +----- + +.. note:: + - rsync must be installed on both the local and remote host. + - For the ``synchronize`` module, the "local host" is the host `the synchronize task originates on`, and the "destination host" is the host `synchronize is connecting to`. + - The "local host" can be changed to a different host by using `delegate_to`. This enables copying between two remote hosts or entirely on one remote machine. + - The user and permissions for the synchronize `src` are those of the user running the Ansible task on the local host (or the remote_user for a delegate_to host when delegate_to is used). + + - The user and permissions for the synchronize `dest` are those of the `remote_user` on the destination host or the `become_user` if `become=yes` is active. + - In Ansible 2.0 a bug in the synchronize module made become occur on the "local host". This was fixed in Ansible 2.0.1. + - Currently, synchronize is limited to elevating permissions via passwordless sudo. This is because rsync itself is connecting to the remote machine and rsync doesn't give us a way to pass sudo credentials in. + - Currently there are only a few connection types which support synchronize (ssh, paramiko, local, and docker) because a sync strategy has been determined for those connection types. Note that the connection for these must not need a password as rsync itself is making the connection and rsync does not provide us a way to pass a password to the connection. + - Expect that dest=~/x will be ~/x even if using sudo. + - Inspect the verbose output to validate the destination user/host/path are what was expected. + - To exclude files and directories from being synchronized, you may add ``.rsync-filter`` files to the source directory. + - rsync daemon must be up and running with correct permission when using rsync protocol in source or destination path. + - The ``synchronize`` module forces `--delay-updates` to avoid leaving a destination in a broken in-between state if the underlying rsync process encounters an error. Those synchronizing large numbers of files that are willing to trade safety for performance should call rsync directly. + - link_destination is subject to the same limitations as the underlying rsync daemon. Hard links are only preserved if the relative subtrees of the source and destination are the same. Attempts to hardlink into a directory that is a subdirectory of the source will be prevented. + + +See Also +-------- + +.. seealso:: + + :ref:`copy_module` + The official documentation on the **copy** module. + :ref:`community.windows.win_robocopy_module` + The official documentation on the **community.windows.win_robocopy** module. + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Synchronization of src on the control machine to dest on the remote hosts + ansible.posix.synchronize: + src: some/relative/path + dest: /some/absolute/path + + - name: Synchronization using rsync protocol (push) + ansible.posix.synchronize: + src: some/relative/path/ + dest: rsync://somehost.com/path/ + + - name: Synchronization using rsync protocol (pull) + ansible.posix.synchronize: + mode: pull + src: rsync://somehost.com/path/ + dest: /some/absolute/path/ + + - name: Synchronization using rsync protocol on delegate host (push) + 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) + 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 + ansible.posix.synchronize: + src: some/relative/path + dest: /some/absolute/path + archive: no + + - name: Synchronization with --archive options enabled except for --recursive + 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 + ansible.posix.synchronize: + src: some/relative/path + dest: /some/absolute/path + checksum: yes + times: no + + - name: Synchronization without --archive options enabled except use --links + 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 + 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 + 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. + ansible.posix.synchronize: + src: /first/absolute/path + dest: /second/absolute/path + delegate_to: delegate.host + + - name: Synchronize two directories on one remote host. + 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. + ansible.posix.synchronize: + src: some/relative/path + dest: /some/absolute/path + delete: yes + recursive: yes + + # This specific command is granted su privileges on the destination + - name: Synchronize using an alternate rsync command + ansible.posix.synchronize: + src: some/relative/path + dest: /some/absolute/path + rsync_path: su -c rsync + + # Example .rsync-filter file in the source directory + # - var # exclude any path whose last part is 'var' + # - /var # exclude any path starting with 'var' starting at the source directory + # + /var/conf # include /var/conf even though it was previously excluded + + - name: Synchronize passing in extra rsync options + ansible.posix.synchronize: + src: /tmp/helloworld + dest: /var/www/helloworld + rsync_opts: + - "--no-motd" + - "--exclude=.git" + + # Hardlink files if they didn't change + - name: Use hardlinks when synchronizing filesystems + ansible.posix.synchronize: + src: /tmp/path_a/foo.txt + dest: /tmp/path_b/foo.txt + link_dest: /tmp/path_a/ + + # Specify the rsync binary to use on remote host and on local host + - hosts: groupofhosts + vars: + ansible_rsync_path: /usr/gnu/bin/rsync + + tasks: + - name: copy /tmp/localpath/ to remote location /tmp/remotepath + ansible.posix.synchronize: + src: /tmp/localpath/ + dest: /tmp/remotepath + rsync_path: /usr/gnu/bin/rsync + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Timothy Appnel (@tima) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/docs/ansible.posix.sysctl.rst b/docs/ansible.posix.sysctl.rst new file mode 100644 index 0000000..a078884 --- /dev/null +++ b/docs/ansible.posix.sysctl.rst @@ -0,0 +1,221 @@ +:orphan: + +.. _ansible.posix.sysctl_module: + + +******************** +ansible.posix.sysctl +******************** + +**Manage entries in sysctl.conf.** + + + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manipulates sysctl entries and optionally performs a ``/sbin/sysctl -p`` after changing them. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ ignoreerrors + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Use this option to ignore errors about unknown keys.
+
+
+ name + +
+ - + / required
+
+ +
The dot-separated path (aka key) specifying the sysctl variable.
+

aliases: key
+
+
+ reload + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
If yes, performs a /sbin/sysctl -p if the sysctl_file is updated. If no, does not reload sysctl even if the sysctl_file is updated.
+
+
+ state + +
+ - +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
Whether the entry should be present or absent in the sysctl file.
+
+
+ sysctl_file + +
+ - +
+
+ Default:
"/etc/sysctl.conf"
+
+
Specifies the absolute path to sysctl.conf, if not /etc/sysctl.conf.
+
+
+ sysctl_set + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
Verify token value with the sysctl command and set with -w if necessary
+
+
+ value + +
+ - +
+
+ +
Desired value of the sysctl key.
+

aliases: val
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + # Set vm.swappiness to 5 in /etc/sysctl.conf + - ansible.posix.sysctl: + name: vm.swappiness + value: '5' + state: present + + # Remove kernel.panic entry from /etc/sysctl.conf + - ansible.posix.sysctl: + name: kernel.panic + state: absent + sysctl_file: /etc/sysctl.conf + + # Set kernel.panic to 3 in /tmp/test_sysctl.conf + - 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 + - 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 + - ansible.posix.sysctl: + name: net.ipv4.ip_forward + value: '1' + sysctl_set: yes + state: present + reload: yes + + + + + +Status +------ + + +Authors +~~~~~~~ + +- David CHANIAL (@davixx) + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.