.. Document meta

:orphan:

.. |antsibull-internal-nbsp| unicode:: 0xA0
    :trim:

.. meta::
  :antsibull-docs: 2.16.3

.. Anchors

.. _ansible_collections.theforeman.foreman.partition_table_module:

.. Anchors: short name for ansible.builtin

.. Title

theforeman.foreman.partition_table module -- Manage Partition Table Templates
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. Collection note

.. note::
    This module is part of the `theforeman.foreman collection <https://galaxy.ansible.com/ui/repo/published/theforeman/foreman/>`_ (version 5.3.0).

    It is not included in ``ansible-core``.
    To check whether it is installed, run :code:`ansible-galaxy collection list`.

    To install it, use: :code:`ansible-galaxy collection install theforeman.foreman`.
    You need further requirements to be able to use this module,
    see :ref:`Requirements <ansible_collections.theforeman.foreman.partition_table_module_requirements>` for details.

    To use it in a playbook, specify: :code:`theforeman.foreman.partition_table`.

.. version_added

.. rst-class:: ansible-version-added

New in theforeman.foreman 1.0.0

.. contents::
   :local:
   :depth: 1

.. Deprecated


Synopsis
--------

.. Description

- Manage Partition Table Templates


.. Aliases

Aliases: foreman_ptable

.. Requirements

.. _ansible_collections.theforeman.foreman.partition_table_module_requirements:

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

- requests






.. Options

Parameters
----------

.. tabularcolumns:: \X{1}{3}\X{2}{3}

.. list-table::
  :width: 100%
  :widths: auto
  :header-rows: 1
  :class: longtable ansible-option-table

  * - Parameter
    - Comments

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-ca_path"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-ca_path:

      .. rst-class:: ansible-option-title

      **ca_path**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-ca_path" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`path`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      PEM formatted file that contains a CA certificate to be used for validation.

      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_CA\_PATH` will be used instead.


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-file_name"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-file_name:

      .. rst-class:: ansible-option-title

      **file_name**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-file_name" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`path`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      The path of a template file, that shall be imported.

      Either this or :emphasis:`layout` is required as a source for the Partition Template "content".


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-layout"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-layout:

      .. rst-class:: ansible-option-title

      **layout**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-layout" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      The content of the Partitioning Table Template

      Either this or :emphasis:`file\_name` is required as a source for the Partition Template "content".


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-locations"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-locations:

      .. rst-class:: ansible-option-title

      **locations**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-locations" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`list` / :ansible-option-elements:`elements=string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      List of locations the entity should be assigned to


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-locked"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-locked:

      .. rst-class:: ansible-option-title

      **locked**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-locked" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`boolean`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      Determines whether the template shall be locked


      .. rst-class:: ansible-option-line

      :ansible-option-choices:`Choices:`

      - :ansible-option-choices-entry:`false`
      - :ansible-option-choices-entry:`true`


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-name"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-name:

      .. rst-class:: ansible-option-title

      **name**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-name" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      The name of the Partition Table.

      If omited, will be determined from the :literal:`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.


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-organizations"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-organizations:

      .. rst-class:: ansible-option-title

      **organizations**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-organizations" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`list` / :ansible-option-elements:`elements=string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      List of organizations the entity should be assigned to


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-os_family"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-os_family:

      .. rst-class:: ansible-option-title

      **os_family**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-os_family" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      The OS family the template shall be assigned with.


      .. rst-class:: ansible-option-line

      :ansible-option-choices:`Choices:`

      - :ansible-option-choices-entry:`"AIX"`
      - :ansible-option-choices-entry:`"Altlinux"`
      - :ansible-option-choices-entry:`"Archlinux"`
      - :ansible-option-choices-entry:`"Coreos"`
      - :ansible-option-choices-entry:`"Debian"`
      - :ansible-option-choices-entry:`"Fcos"`
      - :ansible-option-choices-entry:`"Freebsd"`
      - :ansible-option-choices-entry:`"Gentoo"`
      - :ansible-option-choices-entry:`"Junos"`
      - :ansible-option-choices-entry:`"NXOS"`
      - :ansible-option-choices-entry:`"Rancheros"`
      - :ansible-option-choices-entry:`"Redhat"`
      - :ansible-option-choices-entry:`"Rhcos"`
      - :ansible-option-choices-entry:`"Solaris"`
      - :ansible-option-choices-entry:`"Suse"`
      - :ansible-option-choices-entry:`"VRP"`
      - :ansible-option-choices-entry:`"Windows"`
      - :ansible-option-choices-entry:`"Xenserver"`


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-password"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-password:

      .. rst-class:: ansible-option-title

      **password**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-password" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      Password of the user accessing the Foreman server.

      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_PASSWORD` will be used instead.


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-server_url"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-server_url:

      .. rst-class:: ansible-option-title

      **server_url**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-server_url" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`string` / :ansible-option-required:`required`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      URL of the Foreman server.

      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_SERVER\_URL` will be used instead.


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-state"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-state:

      .. rst-class:: ansible-option-title

      **state**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-state" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      State of the entity

      :literal:`present\_with\_defaults` will ensure the entity exists, but won't update existing ones


      .. rst-class:: ansible-option-line

      :ansible-option-choices:`Choices:`

      - :ansible-option-choices-entry-default:`"present"` :ansible-option-choices-default-mark:`← (default)`
      - :ansible-option-choices-entry:`"present\_with\_defaults"`
      - :ansible-option-choices-entry:`"absent"`


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-updated_name"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-updated_name:

      .. rst-class:: ansible-option-title

      **updated_name**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-updated_name" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      New name of the template. When this parameter is set, the module will not be idempotent.


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-use_gssapi"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-use_gssapi:

      .. rst-class:: ansible-option-title

      **use_gssapi**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-use_gssapi" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`boolean`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication.

      Requires the Python library \ `requests-gssapi <https://github.com/pythongssapi/requests-gssapi>`__ to be installed.

      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_USE\_GSSAPI` will be used instead.


      .. rst-class:: ansible-option-line

      :ansible-option-choices:`Choices:`

      - :ansible-option-choices-entry-default:`false` :ansible-option-choices-default-mark:`← (default)`
      - :ansible-option-choices-entry:`true`


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-username"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-username:

      .. rst-class:: ansible-option-title

      **username**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-username" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`string`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      Username accessing the Foreman server.

      If the value is not specified in the task, the value of environment variable :literal:`FOREMAN\_USERNAME` will be used instead.


      .. raw:: html

        </div>

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__parameter-validate_certs:

      .. rst-class:: ansible-option-title

      **validate_certs**

      .. raw:: html

        <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`boolean`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      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 :literal:`FOREMAN\_VALIDATE\_CERTS` will be used instead.


      .. rst-class:: ansible-option-line

      :ansible-option-choices:`Choices:`

      - :ansible-option-choices-entry:`false`
      - :ansible-option-choices-entry-default:`true` :ansible-option-choices-default-mark:`← (default)`


      .. raw:: html

        </div>


.. Attributes


Attributes
----------

.. tabularcolumns:: \X{2}{10}\X{3}{10}\X{5}{10}

.. list-table::
  :width: 100%
  :widths: auto
  :header-rows: 1
  :class: longtable ansible-option-table

  * - Attribute
    - Support
    - Description

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="attribute-check_mode"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__attribute-check_mode:

      .. rst-class:: ansible-option-title

      **check_mode**

      .. raw:: html

        <a class="ansibleOptionLink" href="#attribute-check_mode" title="Permalink to this attribute"></a>

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      :ansible-attribute-support-label:`Support: \ `\ :ansible-attribute-support-full:`full`


      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      Can run in check\_mode and return changed status prediction without modifying the entity


      .. raw:: html

        </div>


  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="attribute-diff_mode"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__attribute-diff_mode:

      .. rst-class:: ansible-option-title

      **diff_mode**

      .. raw:: html

        <a class="ansibleOptionLink" href="#attribute-diff_mode" title="Permalink to this attribute"></a>

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      :ansible-attribute-support-label:`Support: \ `\ :ansible-attribute-support-full:`full`


      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

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


      .. raw:: html

        </div>



.. Notes


.. Seealso


.. Examples

Examples
--------

.. code-block:: yaml+jinja

    # 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

    - 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

    - 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

    - 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

    # 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"

    # 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'


    # 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

    - 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



.. Facts


.. Return values

Return Values
-------------
Common return values are documented :ref:`here <common_return_values>`, the following are the fields unique to this module:

.. tabularcolumns:: \X{1}{3}\X{2}{3}

.. list-table::
  :width: 100%
  :widths: auto
  :header-rows: 1
  :class: longtable ansible-option-table

  * - Key
    - Description

  * - .. raw:: html

        <div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="return-entity"></div>

      .. _ansible_collections.theforeman.foreman.partition_table_module__return-entity:

      .. rst-class:: ansible-option-title

      **entity**

      .. raw:: html

        <a class="ansibleOptionLink" href="#return-entity" title="Permalink to this return value"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`dictionary`

      .. raw:: html

        </div>

    - .. raw:: html

        <div class="ansible-option-cell">

      Final state of the affected entities grouped by their type.


      .. rst-class:: ansible-option-line

      :ansible-option-returned-bold:`Returned:` success


      .. raw:: html

        </div>


  * - .. raw:: html

        <div class="ansible-option-indent"></div><div class="ansible-option-cell">
        <div class="ansibleOptionAnchor" id="return-entity/ptables"></div>

      .. raw:: latex

        \hspace{0.02\textwidth}\begin{minipage}[t]{0.3\textwidth}

      .. _ansible_collections.theforeman.foreman.partition_table_module__return-entity/ptables:

      .. rst-class:: ansible-option-title

      **ptables**

      .. raw:: html

        <a class="ansibleOptionLink" href="#return-entity/ptables" title="Permalink to this return value"></a>

      .. ansible-option-type-line::

        :ansible-option-type:`list` / :ansible-option-elements:`elements=dictionary`

      .. raw:: html

        </div>

      .. raw:: latex

        \end{minipage}

    - .. raw:: html

        <div class="ansible-option-indent-desc"></div><div class="ansible-option-cell">

      List of partition tables.


      .. rst-class:: ansible-option-line

      :ansible-option-returned-bold:`Returned:` success


      .. raw:: html

        </div>




..  Status (Presently only deprecated)


.. Authors

Authors
~~~~~~~

- Bernhard Hopfenmueller (@Fobhep) ATIX AG
- Matthias Dellweg (@mdellweg) ATIX AG



.. Extra links

Collection links
~~~~~~~~~~~~~~~~

.. ansible-links::

  - title: "Issue Tracker"
    url: "https://github.com/theforeman/foreman-ansible-modules/issues"
    external: true
  - title: "Homepage"
    url: "https://theforeman.org/"
    external: true
  - title: "Repository (Sources)"
    url: "https://github.com/theforeman/foreman-ansible-modules"
    external: true


.. Parsing errors