Extracted the basic role from the madonsible playbook

This commit is contained in:
Emmanouil Kampitakis
2018-06-17 08:48:53 +00:00
commit eb16cabd34
18 changed files with 207 additions and 0 deletions

27
tasks/apt.yml Normal file
View File

@@ -0,0 +1,27 @@
---
- name: Update the installed packages
apt:
update_cache: yes
upgrade: yes
become: true
- name: Install essential packages
package:
name: "{{ item }}"
state: present
become: true
with_items:
- vim
- emacs
- git
- htop
- zsh
- python
- python3
- screen
- tmux
- dnsutils
- stow
- mosh
- fail2ban
- tig

15
tasks/main.yml Normal file
View File

@@ -0,0 +1,15 @@
---
# tasks file for basic
- name: Make apt stuff
include: apt.yml
tags:
- apt
- name: Configure users
include: users.yml
loop: "{{ basic_users }}"
loop_control:
loop_var: os_user
- name: Setup sudo access
include: sudo.yml

8
tasks/sudo.yml Normal file
View File

@@ -0,0 +1,8 @@
---
- name: Give sudo group passwordless sudo
lineinfile:
dest: /etc/sudoers
regexp: "^%sudo"
line: "%sudo ALL=(ALL) NOPASSWD: ALL"
tags: sudo
become: true

16
tasks/users.yml Normal file
View File

@@ -0,0 +1,16 @@
---
- name: "Add user {{ os_user.name }}"
user:
name: "{{ os_user.name }}"
comment: "{{ os_user.comment }}"
uid: "{{ os_user.uid }}"
shell: "{{ os_user.shell }}"
groups: "{{ os_user.groups }}"
state: "{{ os_user.state }}"
become: true
- name: Copy local ssh key to authorized keys file
authorized_key:
user: "{{ os_user.name }}"
key: "{{ os_user.ssh_auth_key }}"
become: true