theforeman.foreman.templates_import (4.0.0) — module

Sync Templates from a repository

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

Authors: Anton Nesterov (@nesanton)

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

Sync provisioning templates, report_templates, partition tables and job templates from external git repository or file system.

Based on foreman_templates plugin U(https://github.com/theforeman/foreman_templates).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Sync templates from git repo
  theforeman.foreman.templates_import:
    repo: https://github.com/theforeman/community-templates.git
    branch: 1.24-stable
    associate: new
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"

Inputs

    
lock:
    description:
    - Lock imported templates.
    required: false
    type: bool

repo:
    description:
    - Filesystem path or repo (with protocol), for example /tmp/dir or git://example.com/repo.git
      or https://example.com/repo.git.
    required: false
    type: str

force:
    description:
    - Update templates that are locked.
    required: false
    type: bool

branch:
    description:
    - Branch of the I(repo). Only for git-based repositories.
    required: false
    type: str

filter:
    description:
    - Sync only templates with name matching this regular expression, after I(prefix)
      was applied.
    - Case-insensitive, snippets are not filtered.
    required: false
    type: str

negate:
    description:
    - Negate the filter condition.
    required: false
    type: bool

prefix:
    description:
    - Adds specified string to beginning of all imported templates that do not yet have
      that prefix.
    required: false
    type: str

dirname:
    description:
    - The directory within Git repo containing the templates.
    required: false
    type: str

verbose:
    description:
    - Add template reports to the output.
    required: false
    type: bool

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

associate:
    choices:
    - always
    - new
    - never
    description:
    - Associate to Operatingsystems, Locations and Organizations based on metadata.
    required: false
    type: str

locations:
    description: List of locations the entity should be assigned to
    elements: str
    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

organizations:
    description: List of organizations the entity 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

message:
  contains:
    branch:
      description: Branch used in the repository.
      type: str
    repo:
      description: Repository, the templates were imported from.
      type: str
  description: Information about the import.
  returned: success
  type: dict
report:
  contains:
    changed:
      description: List of templates that have been updated.
      type: list
    new:
      description: List of templates that have been created.
      type: list
  description: Report of the import.
  returned: success
  type: dict
templates:
  description: Final state of the templates.
  returned: success
  type: dict