product_download – Downloads products from the JBoss Network API.

Note

This module is part of the middleware_automation.common collection.

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install middleware_automation.common.

To use it in a playbook, specify: middleware_automation.common.product_download.

Synopsis

  • Downloads products from the JBoss Network API.

Parameters

Parameter

Comments

api_url

string

Address of the JBoss Network API.

Default: "https://jbossnetwork.api.redhat.com"

attributes

aliases: attr

string

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.

client_id

string

Client ID associated with to download a product from the JBoss Network API.

If value not set, will try environment variable REDHAT_PRODUCT_DOWNLOAD_CLIENT_ID

client_secret

string

Client Secret associated with to download a product from the JBoss Network API.

If value not set, will try environment variable REDHAT_PRODUCT_DOWNLOAD_CLIENT_SECRET

dest

string / required

Absolute .

force

boolean

If true and dest is not a directory, will download the file every time and replace the file if the contents change. If false, the file will only be downloaded if the destination does not exist.

Choices:

  • false ← (default)

  • true

group

string

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.

mode

any

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+rwx or u=rw,g=r,o=r).

If mode is not specified and the destination filesystem object does not exist, the default umask on the system will be used when setting the mode for the newly created filesystem object.

If mode is not specified and the destination filesystem object does exist, the mode of the existing filesystem object will be used.

Specifying mode is the best way to ensure filesystem objects are created with the correct permissions. See CVE-2020-1736 for further details.

owner

string

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.

product_category

string

Type of the Product Category

product_id

string

Product Id for the Redhat customer portal

product_type

string

Type of the Product

product_version

string

Product Version to be downloaded.

selevel

string

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 the level portion of the policy if available.

serole

string

The role part of the SELinux filesystem object context.

When set to _default, it will use the role portion of the policy if available.

setype

string

The type part of the SELinux filesystem object context.

When set to _default, it will use the type portion of the policy if available.

seuser

string

The user part of the SELinux filesystem object context.

By default it uses the system policy, where applicable.

When set to _default, it will use the user portion of the policy if available.

sso_url

string

Address of the Red Hat SSO Server.

Default: "https://sso.redhat.com"

unsafe_writes

boolean

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.

Choices:

  • false ← (default)

  • true

validate_certs

boolean

If false, SSL certificates will not be validated.

Choices:

  • false

  • true ← (default)

Examples

- name: Download Red Hat Product
  middleware_automation.common.product_download:
    client_id: 123e4567-e89b-12d3-a456-426614174000
    client_secret: 0mpkY0i8IdIRWbk6rLXBlf5Jkqq8i4nW
    dest: /tmp/eap-connectors.zip
    product_id: 12345

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

dest

string

destination file/path

Returned: success

Sample: "/path/to/file.txt"

failed

boolean

whether an error occurred downloading the resource

Returned: success

Sample: false

gid

integer

group id of the file

Returned: success

Sample: 100

group

string

group of the file

Returned: success

Sample: "httpd"

md5sum

string

md5 checksum of the file after download

Returned: when supported

Sample: "2a5aeecc61dc98c4d780b14b330e3282"

mode

string

permissions of the target

Returned: success

Sample: "0644"

msg

string

the HTTP message from the request

Returned: always

Sample: "OK (unknown bytes)"

owner

string

owner of the file

Returned: success

Sample: "httpd"

size

integer

size of the target

Returned: success

Sample: 1220

state

string

state of the target

Returned: success

Sample: "file"

uid

integer

owner id of the file, after execution

Returned: success

Sample: 100

Authors

  • Andrew Block (@sabre1041)