theforeman.foreman.location (4.0.0) — module

Manage Locations

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

Authors: Matthias M Dellweg (@mdellweg) ATIX AG

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

Manage Locations


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a simple location
- name: "Create CI Location"
  theforeman.foreman.location:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "My Cool New Location"
    organizations:
      - "Default Organization"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a nested location
- name: "Create Nested CI Location"
  theforeman.foreman.location:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "My Nested location"
    parent: "My Cool New Location"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create a new nested location with parent included in name
- name: "Create New Nested Location"
  theforeman.foreman.location:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "My Cool New Location/New nested location"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Move a nested location to another parent
- name: "Create Nested CI Location"
  theforeman.foreman.location:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "My Cool New Location/New nested location"
    parent: "My Cool New Location/My Nested location"
    state: present

Inputs

    
name:
    description:
    - Name of the Location
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the entity
    type: str

parent:
    description:
    - Title of a parent Location for nesting
    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

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

parameters:
    description:
    - Entity domain specific host parameters
    elements: dict
    required: false
    suboptions:
      name:
        description:
        - Name of the parameter
        required: true
        type: str
      parameter_type:
        choices:
        - string
        - boolean
        - integer
        - real
        - array
        - hash
        - yaml
        - json
        default: string
        description:
        - Type of the parameter
        type: str
      value:
        description:
        - Value of the parameter
        required: true
        type: raw
    type: list

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

ignore_types:
    aliases:
    - select_all_types
    description:
    - List of resources types that will be automatically associated
    elements: str
    required: false
    type: list
    version_added: 3.8.0
    version_added_collection: theforeman.foreman

organizations:
    description:
    - List of organizations the location should be assigned to
    elements: str
    type: list

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

entity:
  contains:
    locations:
      description: List of locations.
      elements: dict
      type: list
  description: Final state of the affected entities grouped by their type.
  returned: success
  type: dict