-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
65 lines (64 loc) · 2.23 KB
/
playbook.yml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
- hosts: upsydaisy
vars:
project: activ_sky
admin_user: felixt
project_user: activ_sky
ruby_compiler: ruby
ruby_version: 2.1.1
install_ruby: false
remote_user: root
sudo: true
tasks:
- name: "Create admin user: {{admin_user}}"
action: "user name={{admin_user}}
update_password=always
groups=sudo
shell=/bin/bash
password=$6$rounds=100000$mqWi51/Z5uaL496H$5Jkl8TC9f4Lhyx2KiSYBvGQ5Sn1Q25oYO.rUlHRhfALNganalEjyMlfk/Mdx5O5OZHL5RmobuHgJ3dN8VdsH60"
- name: "Create project user: {{project_user}}"
action: "user name={{project_user}}
update_password=always
groups=sudo
shell=/bin/bash
password=$6$rounds=100000$X0dLo4kO5Wur4Kfv$7BUHaKBeW0fs5ElMBwDrVehSkLTHLGwOwb1DNZMU5CxRh8ZxlIXYw7rPFWeO5/fMgAPHIJJjvf2tdyJ5hOq44."
# Requires ability to enter password
# name: Copy ssh for activ_sky
# shell: ssh-copy-id {{project}}@{{ansible_hostname}}
- name: Update apt
apt: update_cache=yes cache_valid_time=144000
- name: Install necessary packages
apt: pkg={{ item }} state=latest
with_items:
- build-essential
- git
- name: Install postgres
apt: pkg={{ item }} state=latest
with_items:
- postgresql
- libpq-dev
- python-psycopg2 # needed for postgresql ansible commands
- name: Download ruby-install
sudo: yes
sudo_user: "{{admin_user}}"
get_url:
url: https://github.com/postmodern/ruby-install/archive/v0.4.1.tar.gz
dest: /home/{{admin_user}}/ruby-install-0.4.1.tar.gz
- name: Extract ruby-install
sudo: yes
sudo_user: "{{admin_user}}"
shell: tar -xzvf ruby-install-0.4.1.tar.gz
- name: Install ruby-install
sudo: yes
shell: "cd /home/{{admin_user}}/ruby-install-0.4.1; make install"
# PROJECT SPECIFIC - need to be split
# Install on project's user directory - probably need to install ruby global as well?
- include: tasks/ruby.yml
- include: tasks/postgres.yml
# name: Add ruby to path
# name: Use chruby
# name: Setup postgres user for activ_sky
# name: Deploy app for the first time
# Links:
# https://github.com/hatoishi/ansible-dev/blob/master/ruby-install/tasks/main.yml
# Needed to set sudoers nopasswd beforehand