theforeman.foreman.resource_info module – Gather information about resources
Note
This module is part of the theforeman.foreman collection (version 3.15.0).
You might already have this collection installed if you are using the ansible
package.
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 theforeman.foreman
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: theforeman.foreman.resource_info
.
New in theforeman.foreman 1.0.0
Synopsis
Gather information about resources
Aliases: foreman_search_facts
Requirements
The below requirements are needed on the host that executes this module.
requests
Parameters
Parameter |
Comments |
---|---|
If Choices:
|
|
Scope the searched resource by organization |
|
Add parameters to the API call if necessary If not specified, no additional parameters are passed |
|
Password of the user accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
|
Resource to search Set to an invalid choice like foo see all available options. |
|
Search query to use If None, all resources are returned |
|
URL of the Foreman server. If the value is not specified in the task, the value of environment variable |
|
Username accessing the Foreman server. If the value is not specified in the task, the value of environment variable |
|
Whether or not to verify the TLS certificates of the Foreman server. If the value is not specified in the task, the value of environment variable Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying the entity |
|
Support: full |
Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode |
Notes
Note
Some resources don’t support scoping and will return errors when you pass organization or unknown data in params.
Examples
- name: "Read a Setting"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: settings
search: name = foreman_url
register: result
- debug:
var: result.resources[0].value
- name: "Read all Registries"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: registries
register: result
- debug:
var: item.name
with_items: "{{ result.resources }}"
- name: "Read all Organizations with full details"
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: organizations
full_details: true
register: result
- debug:
var: result.resources
- name: Get all existing subscriptions for organization with id 1
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: subscriptions
params:
organization_id: 1
register: result
- debug:
var: result
- name: Get all existing activation keys for organization ACME
theforeman.foreman.resource_info:
username: "admin"
password: "changeme"
server_url: "https://foreman.example.com"
resource: activation_keys
organization: ACME
register: result
- debug:
var: result
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Resource information Returned: always |