Skip to content

Commit

Permalink
feat: using ansible-role docgen for README geneartion
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinkim committed Dec 10, 2015
1 parent a6d96f4 commit 7c16c02
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 62 deletions.
141 changes: 79 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,65 @@
# Ansible Users Role
# Ansible franklinkim.users role

[![Build Status](https://img.shields.io/travis/weareinteractive/ansible-users.svg)](https://travis-ci.org/weareinteractive/ansible-users)
[![Galaxy](http://img.shields.io/badge/galaxy-franklinkim.supervisor-blue.svg)](https://galaxy.ansible.com/list#/roles/1383)
[![GitHub Tags](https://img.shields.io/github/tag/weareinteractive/ansible-users.svg)](https://github.com/weareinteractive/ansible-users)
[![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/ansible-users.svg)](https://github.com/weareinteractive/ansible-users)
[![Galaxy](http://img.shields.io/badge/galaxy-franklinkim.sudo-blue.svg)](https://galaxy.ansible.com/list#/roles/1385)
[![GitHub tag](https://img.shields.io/github/tag/weareinteractive/ansible-users.svg)](https://github.com/weareinteractive/ansible-users/releases)
[![GitHub stars](https://img.shields.io/github/stars/weareinteractive/ansible-users.svg?style=social&label=Star)](https://github.com/weareinteractive/ansible-users)

> `users` is an [Ansible](http://www.ansible.com) role which:
> `franklinkim.users` is an [Ansible](http://www.ansible.com) role which:
>
> * creates users
> * adds/creates private ssh key
> * configures authorized keys
> * manges users
> * manages user's private key
> * manages user's authorized keys
## Installation

Using `ansible-galaxy`:

```
```shell
$ ansible-galaxy install franklinkim.users
```

Using `requirements.yml`:

```
```yaml
- src: franklinkim.users
```
Using `git`:

```
```shell
$ git clone https://github.com/weareinteractive/ansible-users.git franklinkim.users
```

## Dependencies

* Ansible 1.9
* Ansible >= 1.9

## Variables

Here is a list of all the default variables for this role, which are also available in `defaults/main.yml`.

```
```yaml
---
#
# users:
# - username: foobar (required)
# name: Foo Bar
# uid: 1000
# group: staff
# groups: ["adm", "www-data"]
# home_mode: "0750"
# home_create: yes
# home: /path/to/user/home
# system: no
# authorized_keys: [] (required)
# ssh_key_type: rsa
# ssh_key_bits: 2048
# ssh_key_password: ""
# ssh_key_generate: no
# ssh_key: "xxx"
#
# array of users to add
users: []
# users home directory
Expand All @@ -50,78 +70,69 @@ users_group:
users_groups: []
# default user home directory permissions
users_home_mode: "0755"
```

A user might look like this:

```
# user's name
username: foobar (required)
# user's full name
name: Foo Bar
# primary group
group: staff
# list of secondary groups
groups: ["adm", "www-data"]
# home directory permissions
home_mode: "0750"
# create home directory
home_create: yes
# create as system user
system: no
# list of authorized keys
authorized_keys:
- "xxx"
- "xxx"
# copy a key
ssh_key: "xxx\nxxx\n"
# generate a key
ssh_key_generate: no
# generated key password
ssh_key_password: ""
# generated key bit number
ssh_key_bits: 2048
# generated/copied key type
# (will also define the key file name as id_{{ ssh_key_type }})
ssh_key_type: rsa
```
## Usage

## Example playbook
This is an example playbook:

```
- host: all
```yaml
---
- hosts: all
sudo: yes
roles:
- franklinkim.users
vars:
users:
# regular user
- username: foobar1
name: Foo bar
# user with generated key
- username: foobar2
- username: foobar
name: Foo Bar 1
authorized_keys: []
- username: foobar_authorized_keys
authorized_keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
home_create: yes
- username: foobar_nohome
authorized_keys: []
home_create: no
- username: foobar_groups
authorized_keys: []
groups:
- users
- username: foobar_groups_reset
authorized_keys: []
groups: []
group: foobar_groups_reset
- username: foobar_home_mode
authorized_keys: []
home_mode: "0750"
- username: foobar_key
authorized_keys: []
ssh_key: "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI\nw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP\nkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2\nhMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO\nTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW\nyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd\nELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1\nBw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf\nTK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK\niqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A\nsClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9Xsf\n4m+2ywKBgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/orApiHmHDsURs5rUKDx0f9iP\ncXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsMkE4CUSiJcYrMANtx54cGH7Rk\nEjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTGyAK+OLD3M2QdCQKBgQDtx8pN\nCAxR7yhHbIWT1AH66+XWN8bXq7l3RO/ukeaci98JfkbkxURZhtxV/HHuvUhnPLdX\n3TwygPBYZFNo4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG\nYEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj\n3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+\ndBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz\n6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC\nP9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF\nllYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ\nkda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH\n+vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ\nNE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=\n-----END RSA PRIVATE KEY-----\n"
- username: foobar_key_generate
authorized_keys: []
ssh_key_generate: yes
# user with copies key
- username: foobar3
ssh_key: "xxx"
ssh_key_password: secret
- username: foobar_system
authorized_keys: []
system: yes
users_group: staff
users_groups:
- adm
- www-data
```
*Note: Take a look at the `test.yml` for more examples*
```

## Testing

```
```shell
$ git clone https://github.com/weareinteractive/ansible-users.git
$ cd ansible-users
$ vagrant up
```

## Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests and examples for any new or changed functionality.

1. Fork it
Expand All @@ -130,6 +141,12 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

*Note: To update the `README.md` file please install and run `ansible-role`:*

```shell
$ gem install ansible-role
$ ansible-role docgen
```

## License
Copyright (c) We Are Interactive under the MIT license.

14 changes: 14 additions & 0 deletions meta/readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

galaxy_name: franklinkim.users
github_user: weareinteractive
github_name: ansible-users
badges: |
[![Build Status](https://img.shields.io/travis/weareinteractive/ansible-users.svg)](https://travis-ci.org/weareinteractive/ansible-users)
[![Galaxy](http://img.shields.io/badge/galaxy-franklinkim.sudo-blue.svg)](https://galaxy.ansible.com/list#/roles/1385)
[![GitHub tag](https://img.shields.io/github/tag/weareinteractive/ansible-users.svg)](https://github.com/weareinteractive/ansible-users/releases)
[![GitHub stars](https://img.shields.io/github/stars/weareinteractive/ansible-users.svg?style=social&label=Star)](https://github.com/weareinteractive/ansible-users)
description: |
> * manges users
> * manages user's private key
> * manages user's authorized keys

0 comments on commit 7c16c02

Please sign in to comment.