redhat.satellite.templates_import module – Sync Templates from a repository

Note

This module is part of the redhat.satellite collection (version 3.11.0).

To install it, use: ansible-galaxy collection install redhat.satellite. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: redhat.satellite.templates_import.

New in redhat.satellite 1.0.0

Synopsis

Aliases: foreman_templates_import

Requirements

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

  • requests

Parameters

Parameter

Comments

associate

string

Associate to Operatingsystems, Locations and Organizations based on metadata.

Choices:

  • "always"

  • "new"

  • "never"

branch

string

Branch of the repo. Only for git-based repositories.

dirname

string

The directory within Git repo containing the templates.

filter

string

Sync only templates with name matching this regular expression, after prefix was applied.

Case-insensitive, snippets are not filtered.

force

boolean

Update templates that are locked.

Choices:

  • false

  • true

locations

list / elements=string

List of locations the entity should be assigned to

lock

boolean

Lock imported templates.

Choices:

  • false

  • true

negate

boolean

Negate the filter condition.

Choices:

  • false

  • true

organizations

list / elements=string

List of organizations the entity should be assigned to

password

string / required

Password of the user accessing the Foreman server.

If the value is not specified in the task, the value of environment variable SATELLITE_PASSWORD will be used instead.

prefix

string

Adds specified string to beginning of all imported templates that do not yet have that prefix.

repo

string

Filesystem path or repo (with protocol), for example /tmp/dir or git://example.com/repo.git or https://example.com/repo.git.

server_url

string / required

URL of the Foreman server.

If the value is not specified in the task, the value of environment variable SATELLITE_SERVER_URL will be used instead.

username

string / required

Username accessing the Foreman server.

If the value is not specified in the task, the value of environment variable SATELLITE_USERNAME will be used instead.

validate_certs

boolean

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 SATELLITE_VALIDATE_CERTS will be used instead.

Choices:

  • false

  • true ← (default)

verbose

boolean

Add template reports to the output.

Choices:

  • false

  • true

Attributes

Attribute

Support

Description

check_mode

Support: none

Can run in check_mode and return changed status prediction without modifying the entity

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode

Notes

Note

  • Due to a bug in the foreman_templates plugin, this module won’t report changed=true when the only change is the Organization/Location association of the imported templates. Please see https://projects.theforeman.org/issues/29534 for details.

  • Default values for all module options can be set using redhat.satellite.setting for TemplateSync category or on the settings page in WebUI.

Examples

- name: Sync templates from git repo
  redhat.satellite.templates_import:
    repo: https://github.com/theforeman/community-templates.git
    branch: 1.24-stable
    associate: new
    server_url: "https://satellite.example.com"
    username: "admin"
    password: "changeme"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

message

dictionary

Information about the import.

Returned: success

branch

string

Branch used in the repository.

Returned: success

repo

string

Repository, the templates were imported from.

Returned: success

report

dictionary

Report of the import.

Returned: success

changed

list / elements=string

List of templates that have been updated.

Returned: success

new

list / elements=string

List of templates that have been created.

Returned: success

templates

dictionary

Final state of the templates.

Returned: success

Authors

  • Anton Nesterov (@nesanton)