foreman_search_facts – Gather facts about Foreman resources

Synopsis

  • Gather facts about Foreman resources

Requirements

The below requirements are needed on the host that executes this module.

  • apypie

Parameters

Parameter Choices/Defaults Comments
full_details
boolean
    Choices:
  • no ←
  • yes
If True all details about the found resources are returned

aliases: info
organization
string
Scope the searched resource by organization
params
dictionary
Add parameters to the API call if necessary
If not specified, no additional parameters are passed
password
string / required
Password of the user accessing the Foreman server
resource
string / required
Resource to search
Set to an invalid choice like foo see all available options.
search
string
Search query to use
If None, all resources are returned
server_url
string / required
URL of the Foreman server
username
string / required
Username accessing the Foreman server
validate_certs
boolean
    Choices:
  • no
  • yes ←
Whether or not to verify the TLS certificates of the Foreman server

aliases: verify_ssl

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"
  foreman_search_facts:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    resource: settings
    search: name = http_proxy
  register: result
- debug:
    var: result.resources[0].value

- name: "Read all Registries"
  foreman_search_facts:
    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"
  foreman_search_facts:
    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
  foreman_search_facts:
    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
  foreman_search_facts:
    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 Returned Description
resources
list
always
Search results from Foreman



Status

Authors

  • Sean O’Keeffe (@sean797)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.