doc(role): update README.md
This commit is contained in:
20
LICENSE
Normal file
20
LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Jeff Geerling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
58
README.md
58
README.md
@@ -1,31 +1,63 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
This role will create required groups/users for you
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
This role using the following variables:
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
```yaml
|
||||
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:
|
||||
|
||||
```yaml
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
- 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
|
||||
-------
|
||||
@@ -35,4 +67,4 @@ BSD
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
Maintained by [palkx](https://github.com/palkx)
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
gid: 1004
|
||||
remote-users:
|
||||
gid: 856
|
||||
no-gid-group: {}
|
||||
users:
|
||||
admin:
|
||||
shell: /bin/sh
|
||||
@@ -111,7 +112,6 @@
|
||||
key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIAxFJolWPmbFVMMyD9kxQb353ngyUsEebgkK9AcnjOI cardno:13_460_390'
|
||||
admin4:
|
||||
shell: /bin/bash
|
||||
uid: 1004
|
||||
groups:
|
||||
- admin4
|
||||
- remote-users
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
become: true
|
||||
ansible.builtin.group:
|
||||
name: "{{ group }}"
|
||||
gid: "{{ users_groups[group].get('gid', None) }}"
|
||||
gid: "{{ users_groups[group].get('gid') if 'gid' in users_groups[group] else omit }}"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
append: true
|
||||
groups: "{{ users[username].get('groups', '') }}"
|
||||
shell: "{{ users[username].get('shell', '/bin/bash') }}"
|
||||
uid: "{{ users[username].get('uid', None) }}"
|
||||
uid: "{{ users[username].get('uid') if 'uid' in users[username] else omit }}"
|
||||
|
||||
- name: "Set specific password for user `{{ username }}`"
|
||||
ansible.builtin.user:
|
||||
|
||||
Reference in New Issue
Block a user