Files
ansible-role-users/README.md
Mykhailo Nikiforov 766aad6c32
All checks were successful
checks-test / Lint (push) Successful in 50s
checks-test / molecule (debian11) (push) Successful in 2m8s
checks-test / molecule (rockylinux9) (push) Successful in 2m11s
checks-test / molecule (ubuntu2204) (push) Successful in 2m7s
doc(role): update README.md
2024-01-14 19:55:19 +02:00

2.0 KiB

Role Name

This role will create required groups/users for you

Role Variables

This role using the following variables:

users_groups:
  admin: # group name
    gid: 1000 # group id (optional)
users:
  admin: # user name
    shell: /bin/bash
    uid: 1000 # user id (optional)
    groups:
      - admin
      - remote-users
    passwords:
      # Generate password hashes with openssl passwd -6 -salt <salt> <password>
      default: $6$xyz$nz7SVil2FgVuZ4wjm/1PO31S1QyGBUPVClD55.anfY2pEjs9fUXceRVGsghlUh2I9Jsc2awuh94KOXmNJTcv.0 # This is a default password, it'll be used if no more specific password is specified
      '192.168.0.10': $6$xyz$nz7SVil2FgVuZ4wjm/1PO31S1QyGBUPVClD55.anfY2pEjs9fUXceRVGsghlUh2I9Jsc2awuh94KOXmNJTcv.1 # Password for this exact host. IP is discovered dynamically by ansible
    authorized_keys:
      default:
        key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIAxFJolWPmbFVMMyD9kxQb353ngyUsEebgkK9AcnjOI cardno:13_460_390' # Your ssh key
        state: 'present' # state is optional, 'present' is a default

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

    - hosts: servers
      roles:
         - role: palkx.users
      vars:
        users_groups:
          admin:
            gid: 1050
          remote-users:
            gid: 856
        users:
          admin:
            shell: /bin/bash
            uid: 1000
            groups:
              - admin
              - remote-users
            passwords:
              # Generated with openssl passwd -6 -salt xyz testpass
              default: $6$xyz$nz7SVil2FgVuZ4wjm/1PO31S1QyGBUPVClD55.anfY2pEjs9fUXceRVGsghlUh2I9Jsc2awuh94KOXmNJTcv.0
            authorized_keys:
              default:
                key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIAxFJolWPmbFVMMyD9kxQb353ngyUsEebgkK9AcnjOI cardno:13_460_390'

License

BSD

Author Information

Maintained by palkx