redhat.satellite.partition_table – Manage Partition Table Templates

Note

This plugin is part of the redhat.satellite collection (version 1.5.1).

To install it use: ansible-galaxy collection install redhat.satellite.

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

New in version 1.0.0: of redhat.satellite

Synopsis

  • Manage Partition Table Templates

Requirements

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

  • requests

Parameters

Parameter Choices/Defaults Comments
file_name
path
The path of a template file, that shall be imported.
Either this or layout is required as a source for the Partition Template "content".
layout
string
The content of the Partitioning Table Template
Either this or file_name is required as a source for the Partition Template "content".
locations
list / elements=string
List of locations the entity should be assigned to
locked
boolean
    Choices:
  • no
  • yes
Determines whether the template shall be locked
name
string
The name of the Partition Table.
If omited, will be determined from the name header of the template or the filename (in that order).
The special value "*" can be used to perform bulk actions (modify, delete) on all existing Partition Tables.
organizations
list / elements=string
List of organizations the entity should be assigned to
os_family
string
    Choices:
  • AIX
  • Altlinux
  • Archlinux
  • Coreos
  • Debian
  • Freebsd
  • Gentoo
  • Junos
  • NXOS
  • Rancheros
  • Redhat
  • Solaris
  • Suse
  • Windows
  • Xenserver
The OS family the template shall be assigned with.
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 FOREMAN_PASSWORD will be used instead.
server_url
string / required
URL of the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_SERVER_URL will be used instead.
state
string
    Choices:
  • present ←
  • present_with_defaults
  • absent
State of the entity
present_with_defaults will ensure the entity exists, but won't update existing ones
updated_name
string
New name of the template. When this parameter is set, the module will not be idempotent.
username
string / required
Username accessing the Foreman server.
If the value is not specified in the task, the value of environment variable FOREMAN_USERNAME will be used instead.
validate_certs
boolean
    Choices:
  • no
  • yes ←
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 FOREMAN_VALIDATE_CERTS will be used instead.

Examples

# Keep in mind, that in this case, the inline parameters will be overwritten
- name: "Create a Partition Table inline"
  redhat.satellite.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://satellite.example.com"
    name: A New Partition Template
    state: present
    layout: |
      <%#
        name: A Partition Template
      %>
        zerombr
        clearpart --all --initlabel
        autopart
    locations:
      - Gallifrey
    organizations:
      - TARDIS INC

- name: "Create a Partition Template from a file"
  redhat.satellite.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://satellite.example.com"
    file_name: timeywimey_template.erb
    state: present
    locations:
      - Gallifrey
    organizations:
      - TARDIS INC

- name: "Delete a Partition Template"
  redhat.satellite.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://satellite.example.com"
    name: timeywimey
    layout: |
      <%#
          dummy:
      %>
    state: absent

- name: "Create a Partition Template from a file and modify with parameter(s)"
  redhat.satellite.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://satellite.example.com"
    file_name: timeywimey_template.erb
    name: Wibbly Wobbly Template
    state: present
    locations:
      - Gallifrey
    organizations:
      - TARDIS INC

# Providing a name in this case wouldn't be very sensible.
# Alternatively make use of with_filetree to parse recursively with filter.
- name: "Parsing a directory of partition templates"
  redhat.satellite.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://satellite.example.com"
    file_name: "{{ item }}"
    state: present
    locations:
      - SKARO
    organizations:
      - DALEK INC
    with_fileglob:
       - "./arsenal_templates/*.erb"

# If the templates are stored locally and the ansible module is executed on a remote host
- name: Ensure latest version of all Ptable Community Templates
  redhat.satellite.partition_table:
    server_url: "https://satellite.example.com"
    username: "admin"
    password: "changeme"
    state: present
    layout: '{{ lookup("file", item.src) }}'
  with_filetree: '/path/to/partition/tables'
  when: item.state == 'file'


# with name set to "*" bulk actions can be performed
- name: "Delete *ALL* partition tables"
  redhat.satellite.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://satellite.example.com"
    name: "*"
    state: absent

- name: "Assign all partition tables to the same organization(s)"
  redhat.satellite.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://satellite.example.com"
    name: "*"
    state: present
    organizations:
      - DALEK INC
      - sky.net
      - Doc Brown's garage

Return Values

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

Key Returned Description
entity
dictionary
success
Final state of the affected entities grouped by their type.

 
ptables
list / elements=dictionary
success
List of partition tables.



Authors

  • Bernhard Hopfenmueller (@Fobhep) ATIX AG

  • Matthias Dellweg (@mdellweg) ATIX AG