theforeman.foreman.resource_info (4.0.0) — module

Gather information about resources

| "added in version" 1.0.0 of theforeman.foreman"

Authors: Sean O'Keeffe (@sean797)

Install collection

Install with ansible-galaxy collection install theforeman.foreman:==4.0.0


Add to requirements.yml

  collections:
    - name: theforeman.foreman
      version: 4.0.0

Description

Gather information about resources


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    var: result.resources[0].value
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Read all Registries"
  theforeman.foreman.resource_info:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    resource: registries
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    var: item.name
  with_items: "{{ result.resources }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    var: result.resources
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    var: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    var: result

Inputs

    
params:
    description:
    - Add parameters to the API call if necessary
    - If not specified, no additional parameters are passed
    type: dict

search:
    description:
    - Search query to use
    - If None, all resources are returned
    type: str

password:
    description:
    - Password of the user accessing the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_PASSWORD)
      will be used instead.
    required: true
    type: str

resource:
    description:
    - Resource to search
    - Set to an invalid choice like I(foo) see all available options.
    required: true
    type: str

username:
    description:
    - Username accessing the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_USERNAME)
      will be used instead.
    required: true
    type: str

server_url:
    description:
    - URL of the Foreman server.
    - If the value is not specified in the task, the value of environment variable C(FOREMAN_SERVER_URL)
      will be used instead.
    required: true
    type: str

full_details:
    aliases:
    - info
    default: false
    description:
    - If C(True) all details about the found resources are returned
    type: bool

organization:
    description:
    - Scope the searched resource by organization
    type: str

validate_certs:
    default: true
    description:
    - 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 C(FOREMAN_VALIDATE_CERTS)
      will be used instead.
    type: bool

Outputs

resources:
  description: Resource information
  returned: always
  type: list