Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Willsher committed Jan 12, 2015
2 parents 40a0b8d + a97b889 commit b6fdcb6
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 3 deletions.
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
language: python
python: "2.7"

before_install:
# Make sure everything's up to date.
- sudo apt-get update -qq

install:
# Install Ansible.
- pip install ansible

# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"


script:
# Check the roles syntax
- "ansible-playbook -i tests/inventory tests/test.yml --syntax-check"

# Run the role
- "ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo"

# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Tests user is correct
- id testuser1 | grep 'uid=1010(testuser1) gid=1010(testuser1) groups=1010(testuser1),27(sudo),998(testgroup1),1011(testgroup2)'
- id testuser2 | grep 'uid=999(testuser2) gid=998(testgroup1) groups=998(testgroup1)'
# Test for home directories
- test -d /home/testuser1
- test ! -d /home/testuser2
# Check ssh key
- sudo grep 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDPP/lgoFiuniGtCgmEXuwxmpeimWKoyAGgrHOaTfhnSBiIiDmh2pA3eNlm+iMk9tg103RDKMk4iWmsxlllormmdvAIy7P9L7oobuxtPAOQHqXr1zHwH3sbi2u3RQKmoxs= testkey' /home/testuser1/.ssh/authorized_keys
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.2.0 12 January 2015 Matt Willsher <[email protected]>
* Fix naming issue for users_ssh_keys and correct documentation
* Add Travis tests
0.1.1 12 January 2015 Matt Willsher <[email protected]>
* Set allow_duplicates to yes in the meta data
* createhome can be set per-user
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/WillsherSystems/ansible-users.svg?branch=master)](https://travis-ci.org/WillsherSystems/ansible-sshd) [![Ansible Galaxy](http://img.shields.io/badge/galaxy-willshersystems.users-660198.svg?style=flat)](https://galaxy.ansible.com/list#/roles/2562)

User management
===============

Expand Down Expand Up @@ -94,7 +96,7 @@ users_groups:
### SSH Keys
* user_ssh_keys
* users_ssh_keys
A list of users, each containing a key with a list of public SSH keys as its
value.
Expand Down Expand Up @@ -179,7 +181,7 @@ Example Playbook
state: absent
users_groups:
- name: beancounters
ssh_keys:
users_ssh_keys:
- name: carl
keys:
- ssh-rsa AAAA....... [email protected]
Expand Down
2 changes: 1 addition & 1 deletion tasks/ssh_keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
user='{{ item.0.name }}'
key='{{ item.1 }}'
with_subelements:
- user_ssh_keys
- users_ssh_keys
- keys
1 change: 1 addition & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost
29 changes: 29 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- hosts: localhost
remote_user: root
vars:
users:
- name: testuser1
comment: 'Test User'
is_admin: true
uid: 1010
groups:
- testgroup1
- testgroup2
- name: testuser2
uid: 999
createhome: false
group: testgroup1
users_groups:
- name: testgroup1
gid: 998
system: true
- name: testgroup2
gid: 1011
users_ssh_keys:
- name: testuser1
keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDPP/lgoFiuniGtCgmEXuwxmpeimWKoyAGgrHOaTfhnSBiIiDmh2pA3eNlm+iMk9tg103RDKMk4iWmsxlllormmdvAIy7P9L7oobuxtPAOQHqXr1zHwH3sbi2u3RQKmoxs= testkey
roles:
- ansible-users

0 comments on commit b6fdcb6

Please sign in to comment.