Skip to content

Commit

Permalink
Reorganized tasks in common role and delete small playbooks
Browse files Browse the repository at this point in the history
  • Loading branch information
danypr92 committed Sep 26, 2017
1 parent 2d40561 commit f8a6ae4
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 26 deletions.
9 changes: 0 additions & 9 deletions playbooks/users.yml

This file was deleted.

18 changes: 18 additions & 0 deletions roles/common/tasks/install_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: install common packages
apt:
pkg={{ item }}
state=present
become: yes
with_items:
- python-dev
- libxml2
- libxml2-dev
- libxslt1-dev
- lib32z1-dev
- libssl-dev
- zlib1g-dev
- libldap2-dev
- libsasl2-dev
- git
- wkhtmltopdf
20 changes: 3 additions & 17 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
---
- name: install common packages
apt:
pkg={{ item }}
state=present
become: yes
with_items:
- python-dev
- libxml2
- libxml2-dev
- libxslt1-dev
- lib32z1-dev
- libssl-dev
- zlib1g-dev
- libldap2-dev
- libsasl2-dev
- git
- wkhtmltopdf
- include: users.yml
- include: install_packages.yml

31 changes: 31 additions & 0 deletions roles/common/tasks/users.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---

# Setup a default user - Work user.

- name: create users
become: yes
user:
name="{{ item.key }}"
groups="{{ item.value.group }}"
append=yes
state="{{ item.value.state }}"
shell=/bin/bash
with_dict: "{{ users }}"

- name: ssh keys
become: yes
authorized_key:
user={{ item.key }}
key="{{ lookup('file', item.value.key) }}"
state={{ item.value.state }}
when: item.value.state == "present"
with_dict: "{{ users }}"

- name: add custom sudoer file
become: yes
template:
src=sudoer.j2
dest="/etc/sudoers.d/90-{{ item.key }}"
mode=0440
when: item.value.state == "present"
with_dict: "{{ users }}"
2 changes: 2 additions & 0 deletions roles/common/templates/sudoer.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# {{ item.key }} needs passwordless sudo functionality.
{{ item.key }} ALL=(ALL) NOPASSWD:ALL

0 comments on commit f8a6ae4

Please sign in to comment.