.. _vyos.rest.vyos_user_module: ******************* vyos.rest.vyos_user ******************* **Manage user accounts on VyOS devices using REST API** Version added: 1.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - Manages local user accounts on VyOS devices via the REST API. - Uses REST API (``connection=httpapi``) instead of CLI. - Passwords are write-only. Once set, they cannot be read back in plaintext. - Use ``update_password=on_create`` to avoid resetting passwords on every run. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
state
string
    Choices:
  • present ←
  • absent
  • gathered
present ensures users exist with the specified configuration.
absent removes specified users.
gathered returns current user configuration as structured data.
users
list / elements=dictionary
List of user definitions.
full_name
string
Full name of the user.
name
string / required
Username.
password
string
Plaintext password. Write-only — hashed on device immediately.
public_keys
list / elements=dictionary
SSH public keys for the user.
key
string / required
Base64-encoded public key.
name
string / required
Key identifier/name.
type
string / required
    Choices:
  • ssh-dss
  • ssh-rsa
  • ecdsa-sha2-nistp256
  • ecdsa-sha2-nistp384
  • ecdsa-sha2-nistp521
  • ssh-ed25519
Key type.
update_password
string
    Choices:
  • always ←
  • on_create
Control when password is updated.
always updates the password on every run (default).
on_create only sets the password when the user is first created.

Notes ----- .. note:: - Requires ``ansible_connection=httpapi`` with the VyOS httpapi plugin. - ``ansible_network_os`` must be set to ``vyos.rest.vyos``. - The ``vyos`` user cannot be deleted as it is required for API access. - Passwords are hashed immediately by VyOS and cannot be read back. Examples -------- .. code-block:: yaml - name: Create user vyos.rest.vyos_user: users: - name: alice full_name: Alice Smith password: securepassword update_password: on_create state: present - name: Add SSH public key vyos.rest.vyos_user: users: - name: alice public_keys: - name: alice-laptop type: ssh-rsa key: AAAAB3NzaC1yc2EAAAADAQABAAAB... state: present - name: Delete user vyos.rest.vyos_user: users: - name: alice state: absent - name: Gather all users vyos.rest.vyos_user: state: gathered Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
after
list
when changed
User configuration after this module ran.

before
list
always
User configuration before this module ran.

commands
list
always
List of API command tuples sent to the device.

gathered
list
when state is gathered
Current user configuration as structured data.

response
dictionary
when changes are applied
Raw API response.

saved
boolean
when changes are applied
Whether the config was saved after changes.



Status ------ Authors ~~~~~~~ - VyOS Community (@vyos)