Advertisement
Guest User

Untitled

a guest
Nov 14th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. [![Build Status](https://travis-ci.org/willshersystems/ansible-users.svg?branch=master)](https://travis-ci.org/willshersystems/ansible-users)
  2. [![Ansible Galaxy](http://img.shields.io/badge/galaxy-willshersystems.users-660198.svg?style=flat)](https://galaxy.ansible.com/list#/roles/2562)
  3.  
  4. User management
  5. ===============
  6.  
  7. Configure users, group, SSH keys and administrative sudo access. The role can:
  8.  
  9. * Add and remove groups
  10. * Add and remove users
  11. * Install SSH keys for users
  12. * Configure sudo to allow root access for the administration group
  13.  
  14. Requirements
  15. ------------
  16.  
  17. Tested on:
  18.  
  19. * Ubuntu 14.04 LTS
  20.  
  21. Should work with:
  22.  
  23. * All Ubuntu
  24. * All Debian
  25. * All EL 6,7 based distros
  26.  
  27. Role Variables
  28. --------------
  29.  
  30. ### Users
  31.  
  32. * users
  33.  
  34. A list containing dictionaries of configuration. Each list item can have the
  35. following elements. *Italic text* indicates the default.
  36.  
  37. * name **required**
  38. * state (*present*)
  39. * uid
  40. * group (*item.name*)
  41. * groups
  42. * shell (*{{ users_default_shell }}*)
  43. * comment (*Unknown user*)
  44. * password (*{{ users_default_password }}*)
  45. * home (*/home/{{item.name}}*)
  46. * createhome (*{{ users_create_homedirs }}*)
  47. * system
  48. * is_admin
  49.  
  50. *users_default_password* is set to watching the default password is for new
  51. accounts for the given OS, e.g. !!
  52.  
  53. All other variable defaults are given below.
  54.  
  55. *is_admin* is a boolean. If set, the user is added to the OSs admin group.
  56.  
  57. All other items correspond to the ansible users module parameters.
  58.  
  59. #### Example
  60.  
  61. ```yaml
  62. users:
  63. - name: alice
  64. comment: Alice
  65. password: '$6$hE1TkH.X$F9flUhXGiL8zI4lOioqp1FxN8L8HrMbuP4ZFVbv5MnyeQFAhIAsbTmT6t7.p93FgyiJo3U/aJeiGHzCTUvA.s.'
  66. is_admin: yes
  67. groups:
  68. - devs
  69. - mgmt
  70. - name: bob
  71. state: absent
  72. ```
  73.  
  74. ### Groups
  75.  
  76. * users_groups
  77.  
  78. A list of user groups to create. Each list item can have the following elements.
  79. *Italic text* indicates the default.
  80.  
  81. * name **required**
  82. * state (*present*)
  83. * system
  84. * gid
  85.  
  86. #### Example
  87.  
  88. ```yaml
  89. users_groups:
  90. - name: devs
  91. gid: 1000
  92. - name: mgmt
  93. gid: 2000
  94. - name: hr
  95. state: absent
  96. ```
  97.  
  98. ### SSH Keys
  99.  
  100. * users_ssh_keys
  101.  
  102. A list of users, each containing a key with a list of public SSH keys as its
  103. value.
  104.  
  105. * name
  106. * keys
  107.  
  108. name is the username.
  109.  
  110. keys is a list of public SSH keys.
  111.  
  112. #### Example
  113.  
  114. ```yaml
  115. users_ssh_keys:
  116. - name: alice
  117. keys:
  118. - ssh-rsa AAAA..... alice@somewhere.com
  119. - ssh-rsa AAAA..... alice@elsewhere.com
  120. - name: bob
  121. keys:
  122. - ssh-rsa AAAA.... bob@somewhere.com
  123. ```
  124.  
  125. ### Tuning configuration
  126.  
  127. * users_default_shell
  128.  
  129. The default shell for a user if none is specified. Defaults to `/bin/bash`
  130.  
  131. * users_create_homedirs
  132.  
  133. Create home dirs for new users? Set this to false if you manage home directories
  134. in some other way. Defaults to *true*.
  135.  
  136. * users_per_user_groups
  137.  
  138. Create groups for users with the same name as the users group. Defaults to
  139. *true*
  140.  
  141. ### Sudo configuration
  142.  
  143. * users_manage_admin_sudoers
  144.  
  145. If true, create sudo configuration to allow users in the admin group to become
  146. root via sudo. Defaults to *true*
  147.  
  148. * users_admin_uses_ansible
  149.  
  150. If true, assume the admin group is also used to run Ansible jobs. This disables
  151. requiretty for the admin group in the sudoers configuration. Defaults to *true*
  152.  
  153. * users_admin_sudo_password
  154.  
  155. If true require a password for sudo, false to not require a password. Defaults
  156. to *true*
  157.  
  158. Dependencies
  159. ------------
  160.  
  161. None
  162.  
  163. Example Playbook
  164. ----------------
  165.  
  166. ```yaml
  167. ---
  168. - hosts: all
  169. sudo: true
  170. vars:
  171. users_admin_sudo_password: false
  172. roles:
  173. - role: willshersystems.users
  174. users:
  175. - name: carl
  176. uid: 1010
  177. comment: 'Carl Crisp'
  178. is_admin: yes
  179. groups:
  180. - beancounters
  181. - name: ec_user
  182. state: absent
  183. users_groups:
  184. - name: beancounters
  185. users_ssh_keys:
  186. - name: carl
  187. keys:
  188. - ssh-rsa AAAA....... carl@accounts.example.com
  189. ```
  190.  
  191. License
  192. -------
  193.  
  194. LGPLv3
  195.  
  196. Author Information
  197. ------------------
  198.  
  199. Matt Willsher, matt@willsher.systems
  200.  
  201. (c)2015 Willsher Systems
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement