This repository has been archived by the owner on Jul 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
=============== | ||
|
||
|
@@ -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. | ||
|
@@ -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] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
user='{{ item.0.name }}' | ||
key='{{ item.1 }}' | ||
with_subelements: | ||
- user_ssh_keys | ||
- users_ssh_keys | ||
- keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|