wittdennis.user

User Management Ansible Role

This Ansible role helps you create and manage a user along with their public key.

Requirements

  • No special requirements.

Role Variables

Variable Description Required Default
user__login The username for the new user. Yes ""
user__password_hash The hashed password for the user. For instructions on how to generate this, visit this guide. Yes ""
user__public_key_file The file path to the user's public SSH key. Yes ""
user__sudo_superuser Whether the user can use sudo to execute commands as the superuser. false
user__shell The default shell that the user will use. "/bin/bash"
user__comment A comment or description for the user. ""

Dependencies

  • None

Example Playbook

Here are examples showing how to use this role in a playbook:

# To create a normal user
- hosts: servers
  roles:
      - role: wittdennis.user
        vars:
          user__login: "myuser"
          user__password_hash: "password_hash"
          user__public_key_file: "~/.ssh/id_ed25519.pub"

# To create a user with sudo rights and a custom shell
- hosts: servers
  roles:
      - role: wittdennis.user
        vars:
          user__login: "myuser"
          user__password_hash: "password_hash"
          user__public_key_file: "~/.ssh/id_ed25519.pub"
          user__sudo_superuser: true
          user__shell: "/bin/zsh"

License

  • This role is licensed under MIT.
Informazioni sul progetto

Ansible role to create a user

Installa
ansible-galaxy install wittdennis.user
Licenza
mit
Download
3k
Proprietario
Doing Stuff!