andreazorzetto.Linux-Users-SSH-Sudo

Ansible-User-Setup

Role Tasks

  • Create users
  • Set passwords for users
  • Install SSH keys
  • Give full sudo access
  • Add custom sudo commands
  • Add extra groups for users
  • Delete users
  • Accept custom users list/files

How to Use This Role:

There are 2 ways to set up users with this role:

  1. Use a file with user details (the file must end with .yml since Ansible 2.2):
  - role: ansible-user-setup
    ansible_users_file: my-team.yml
  1. Specify user details directly in the playbook:
  - role: ansible-user-setup
    users:
    - name: vagrant
      description: vagrant
      key:
        - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1DB5VISZ6JokIpyKlCUCONCpaC9697YcJCIJsuMTUQM5IFKeHs
      sudo: yes
      deleted: no

Continue reading to learn more about the user configuration options.

User Fields

To create a new user, add the necessary information in the right vars file.

User fields:

  • name (required)
  • description
  • password (this is a password hash for Linux)
  • key
  • sudo (required)
  • custom_sudo
  • additional_groups
  • deleted (required)

Example of a complete user:

users:
  - name: username
    description: Full Name
    password: $6$F2gxqZJi$3q9lsRPYgyPZO4J4wJnz6MP37U1Y5Rh1IEips4vKmnR7d9AK3KMnKdA2KG.4TBTun
    key:
      - ssh-rsa key1adijhsadlijkfnlsadijknf
      - ssh-rsa key2asdhjfbsakdjbfksaddsdas
    sudo: no
    custom_sudo:
    - "ALL=(ALL) NOPASSWD: /usr/bin/dpkg *"
    additional_groups:
      - www-data
      - wheel
    deleted: no

To delete a user, change the deleted value to yes, then run the role and remove the user from the vars file.

Installa
ansible-galaxy install andreazorzetto.Linux-Users-SSH-Sudo
Licenza
Unknown
Download
204
Proprietario