krb_request – Downloads/fetches the content of a SPNEGO secured URL
Synopsis
Downloads/fetches the content of a SPNEGO secured URL
A kerberos ticket should be already issued
Parameters
- url (True, str, None)
The URL to retrieve the content from
- method (optional, str, GET)
The HTTP method to use in the request
- verify_ssl (False, bool, True)
Enables/disables using TLS to reach the URL
- body (False, raw, None)
The body to send as json.
- dest (False, str, None)
Path to the destination file/dir where the content should be downloaded
If not provided the content won’t be written into disk
- mode (optional, raw, None)
The permissions the resulting filesystem object should have.
For those used to /usr/bin/chmod remember that modes are actually octal numbers. You must give Ansible enough information to parse them correctly. For consistent results, quote octal numbers (for example,
'644'or'1777') so Ansible receives a string and can do its own conversion from string into number. Adding a leading zero (for example,0755) works sometimes, but can fail in loops and some other circumstances.Giving Ansible a number without following either of these rules will end up with a decimal number which will have unexpected results.
As of Ansible 1.8, the mode may be specified as a symbolic mode (for example,
u+rwxoru=rw,g=r,o=r).If
modeis not specified and the destination filesystem object does not exist, the defaultumaskon the system will be used when setting the mode for the newly created filesystem object.If
modeis not specified and the destination filesystem object does exist, the mode of the existing filesystem object will be used.Specifying
modeis the best way to ensure filesystem objects are created with the correct permissions. See CVE-2020-1736 for further details.- owner (optional, str, None)
Name of the user that should own the filesystem object, as would be fed to chown.
When left unspecified, it uses the current user unless you are root, in which case it can preserve the previous ownership.
Specifying a numeric username will be assumed to be a user ID and not a username. Avoid numeric usernames to avoid this confusion.
- group (optional, str, None)
Name of the group that should own the filesystem object, as would be fed to chown.
When left unspecified, it uses the current group of the current user unless you are root, in which case it can preserve the previous ownership.
- seuser (optional, str, None)
The user part of the SELinux filesystem object context.
By default it uses the
systempolicy, where applicable.When set to
_default, it will use theuserportion of the policy if available.- serole (optional, str, None)
The role part of the SELinux filesystem object context.
When set to
_default, it will use theroleportion of the policy if available.- setype (optional, str, None)
The type part of the SELinux filesystem object context.
When set to
_default, it will use thetypeportion of the policy if available.- selevel (optional, str, None)
The level part of the SELinux filesystem object context.
This is the MLS/MCS attribute, sometimes known as the
range.When set to
_default, it will use thelevelportion of the policy if available.- unsafe_writes (optional, bool, False)
Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target filesystem object.
By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target filesystem objects, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted filesystem objects, which cannot be updated atomically from inside the container and can only be written in an unsafe manner.
This option allows Ansible to fall back to unsafe methods of updating filesystem objects when atomic operations fail (however, it doesn’t force Ansible to perform unsafe writes).
IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption.
- attributes (optional, str, None)
The attributes the resulting filesystem object should have.
To get supported flags look at the man page for chattr on the target system.
This string should contain the attributes in the same order as the one displayed by lsattr.
The
=operator is assumed as default, otherwise+or-operators need to be included in the string.
Examples
- name: Get some content
cifmw.general.krb_request:
url: "http://someurl.local/resource"
dest: "{{ ansible_user_dir }}/content.raw"
mode: "0644"
register: _fetched_content
- name: Show base64 content
debug:
msg: "{{ _fetched_content.response_b64 }}"
Return Values
- status_code (returned request, int, )
HTTP response code
- content_type (returned request, str, )
HTTP response Content-Type header content
- headers (returned request, dict, )
HTTP response headers
- response_b64 (successful request, str, )
Returned content base64 encoded
- response_json (successful request that returned application/json, str, )
Returned content as a dict
- path (successful request, str, )
Written file path