-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.yml
More file actions
43 lines (32 loc) · 1.34 KB
/
bootstrap.yml
File metadata and controls
43 lines (32 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
# file: bootstrap.yml
# This playbook is intended to set up keys and other
# goodies for new Ansible hosts. Put new hosts in bootstrap
# and then run it according to the instructions in the repo.
- hosts: bootstrap
become: yes
vars_files:
- "vars/common.yml"
- [ "vars/{{ansible_os_family}}.yml", "vars/common.yml" ]
tasks:
#role:bootstrap
- name: Users - Create the 'glass' user for management purposes
user: name=glass shell=/bin/bash comment="Magic Glass Management User"
- name: Groups - Add the 'glass' user to the sudoers user group.
user: name=glass groups='{{ sudo_group }}'
- name: SSH - Add public key to the remote host
authorized_key: user='{{ glass_user }}' key="{{ lookup('file', 'secrets/ssh/glass-deploy.pub') }}"
- name: Sudo - Add an additional "sudoers" policy to allow for passwordless sudo
template: src=sudo/sudoers.d/glass dest=/etc/sudoers.d/glass validate='/usr/sbin/visudo -cf %s' mode=0440
- name: SSH - Add read-only key for Git access
copy: src='secrets/ssh/edison-git-read-only' dest='/home/glass/.ssh/id_rsa' mode=0600 owner=glass group=glass
- name: Ansible - install key packages
apt:
update_cache: yes
name:
- ansible
- python3-apt
- python3-debian
- git
state: latest
# TODO: remove bootstrap key from authorized hosts