theforeman.foreman.partition_table (4.0.0) — module

Manage Partition Table Templates

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

Authors: Bernhard Hopfenmueller (@Fobhep) ATIX AG, Matthias 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 Partition Table Templates


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# Keep in mind, that in this case, the inline parameters will be overwritten
- name: "Create a Partition Table inline"
  theforeman.foreman.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: A New Partition Template
    state: present
    layout: |
      <%#
        name: A Partition Template
      %>
        zerombr
        clearpart --all --initlabel
        autopart
    locations:
      - Gallifrey
    organizations:
      - TARDIS INC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create a Partition Template from a file"
  theforeman.foreman.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    file_name: timeywimey_template.erb
    state: present
    locations:
      - Gallifrey
    organizations:
      - TARDIS INC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Delete a Partition Template"
  theforeman.foreman.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: timeywimey
    layout: |
      <%#
          dummy:
      %>
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create a Partition Template from a file and modify with parameter(s)"
  theforeman.foreman.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    file_name: timeywimey_template.erb
    name: Wibbly Wobbly Template
    state: present
    locations:
      - Gallifrey
    organizations:
      - TARDIS INC
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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"
  theforeman.foreman.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    file_name: "{{ item }}"
    state: present
    locations:
      - SKARO
    organizations:
      - DALEK INC
  with_fileglob:
    - "./arsenal_templates/*.erb"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  theforeman.foreman.partition_table:
    server_url: "https://foreman.example.com"
    username: "admin"
    password: "changeme"
    state: present
    layout: '{{ lookup("file", item.src) }}'
  with_filetree: '/path/to/partition/tables'
  when: item.state == 'file'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

# with name set to "*" bulk actions can be performed
- name: "Delete *ALL* partition tables"
  theforeman.foreman.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "*"
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Assign all partition tables to the same organization(s)"
  theforeman.foreman.partition_table:
    username: "admin"
    password: "changeme"
    server_url: "https://foreman.example.com"
    name: "*"
    state: present
    organizations:
      - DALEK INC
      - sky.net
      - Doc Brown's garage

Inputs

    
name:
    description:
    - The name of the Partition Table.
    - If omited, will be determined from the C(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.
    required: false
    type: str

state:
    choices:
    - present
    - present_with_defaults
    - absent
    default: present
    description:
    - State of the entity
    - C(present_with_defaults) will ensure the entity exists, but won't update existing
      ones
    type: str

layout:
    description:
    - The content of the Partitioning Table Template
    - Either this or I(file_name) is required as a source for the Partition Template "content".
    required: false
    type: str

locked:
    description:
    - Determines whether the template shall be locked
    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

file_name:
    description:
    - The path of a template file, that shall be imported.
    - Either this or I(layout) is required as a source for the Partition Template "content".
    required: false
    type: path

locations:
    description: List of locations the entity should be assigned to
    elements: str
    type: list

os_family:
    choices:
    - AIX
    - Altlinux
    - Archlinux
    - Coreos
    - Debian
    - Fcos
    - Freebsd
    - Gentoo
    - Junos
    - NXOS
    - Rancheros
    - Redhat
    - Rhcos
    - Solaris
    - Suse
    - VRP
    - Windows
    - Xenserver
    description:
    - The OS family the template shall be assigned with.
    required: false
    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

updated_name:
    description: New name of the template. When this parameter is set, the module will
      not be idempotent.
    required: false
    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

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