Skip to content

Proposal: Add proxmox_domain_realm module #280

@PendaGTP

Description

@PendaGTP

SUMMARY

Add a new module to manage PVE authentication realms.

I'm currently implementing this module and would like to get feedback before opening a PR. I also have several design questions (see below).

Current implementation proposal

A generic module named proxmox_domain_realm to manage all realm types (ad, ldap, openid, ...).

Module documentation:

module: proxmox_domain_realm
short_description: Management of authentication realms for Proxmox VE cluster
description:
  - Create, update or delete Proxmox VE authentication realms.
author:
  - Clément Cruau (@PendaGTP)
version_added: "1.6.0"
attributes:
  check_mode:
    support: full
  diff_mode:
    support: none
options:
  realm:
    description:
      - The realm name.
    type: str
    aliases: ["name"]
    required: true
  state:
    description:
      - Desired state of the realm.
    choices: ["present", "absent"]
    default: present
    type: str
  type:
    description:
      - The realm type.
      - Only required when O(state=present).
    type: str
    choices: ["ad", "ldap", "openid", "pam", "pve"]
  options:
    description:
      - Realm configuration options.
      - See U(https://pve.proxmox.com/wiki/Manual:_datacenter.cfg) and L(Authentication Realms,https://pve.proxmox.com/pve-docs/chapter-pveum.html).
      - The entire value is masked in logs.
    type: dict

seealso:
  - module: community.proxmox.proxmox_domain_info
    description: Retrieve information about Proxmox VE authentication realms.

extends_documentation_fragment:
  - community.proxmox.proxmox.actiongroup_proxmox
  - community.proxmox.proxmox.documentation
  - community.proxmox.attributes

Examples:

- name: Update the comment on the pam realm
  community.proxmox.proxmox_domain_realm:
    api_host: node1
    api_user: root@pam
    api_password: password
    realm: pam
    type: pam
    options:
      comment: Updated PAM authentication comment

- name: Create a new Proxmox VE openid realm
  community.proxmox.proxmox_domain_realm:
    api_host: node1
    api_user: root@pam
    api_password: password
    realm: openid
    type: openid
    options:
      comment: OpenID authentication
      client-id: 1234567890
      client-key: 1234567890
      issuer-url: https://example.com/issuer

- name: Delete a Proxmox VE openid realm
  community.proxmox.proxmox_domain_realm:
    api_host: node1
    api_user: root@pam
    api_password: password
    realm: openid
    state: absent

Full implementation draft

Design Questions

Handling realm options, with options param:

Currently:

  • options is a simple dict
  • No pre-validation is performed
  • The entire options dict is marked with no_log=True

Questions:

  • Is masking the entire options dict acceptable?
  • Should all possible realm parameters be explicitly defined as module options instead of using a generic dict?

What are your thoughts? Any feedback or suggestions are welcome. If preferred, I can open a draft PR with the current implementation.

ISSUE TYPE

  • Feature Idea

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions