-
Notifications
You must be signed in to change notification settings - Fork 4
/
1-ubuntu1204_single_server.yml
111 lines (93 loc) · 2.87 KB
/
1-ubuntu1204_single_server.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
- name: Prepare single Ubuntu Server for edX Installation
hosts: all
user: ubuntu
sudo: True
gather_facts: False
vars:
# Playbook
local_conf: False
config_folder: configuration
config_repo: https://github.com/edx/configuration.git
openedx_version: named-release/birch
# System
TIMEZONE: Europe/Zurich
LOCALE: en_GB.UTF-8
handlers:
- name: update tzdata
command: dpkg-reconfigure --frontend noninteractive tzdata
- name: reboot
command: shutdown -r now 'Rebooting to complete system upgrade'
removes=/var/run/reboot-required
tasks:
- name: Generate locales
command: locale-gen {{ LOCALE }}
- name: Set locale
command: >
/usr/sbin/update-locale
LANG={{ LOCALE }}
LANGUAGE={{ LOCALE }}
LC_ALL={{ LOCALE }}
- name: Set /etc/timezone
template: src=templates/etc/timezone dest=/etc/timezone
notify: update tzdata
- name: Update System
apt: update_cache=yes
- name: Upgrade System
apt: upgrade=full
notify: reboot
- name: Install packages
action: apt pkg={{item}} state=installed
with_items:
# basics
- htop
- unzip
# security
- unattended-upgrades
# edx requirements
- build-essential
- software-properties-common
- python-software-properties
- curl
- libxml2-dev
- libxslt1-dev
- libfreetype6-dev
- python-pip
- python-apt
- python-dev
- git-core
- python-virtualenv
- virtualenvwrapper
- gcc
- autoconf
- g++
- ca-certificates
- name: Prepare PIP
shell: sudo pip install --upgrade pip && sudo pip install --upgrade virtualenv && sudo pip install --upgrade virtualenvwrapper
- name: Check if directory already exists
stat: path=/var/tmp/configuration
register: p
- name: Remove existing configuration directory
shell: sudo rm -r /var/tmp/configuration
when: p.stat.isdir is defined and p.stat.isdir
- name: Pull Repo - Local
synchronize: src=../{{ config_folder }} dest=/var/tmp/ recursive=yes
when: local_conf
- name: Rename Configuration folder
shell: mv /var/tmp/{{ config_folder }} /var/tmp/configuration
when: local_conf
- name: Pull Repo - Origin
git: >
dest=/var/tmp/{{ config_folder }}
repo={{ config_repo }}
version={{ openedx_version }}
accept_hostkey=yes
when: local_conf == False
- name: Check if directory already exists
stat: path=/var/tmp/configuration
register: check_path
- name: Rename Configuration folder
shell: mv /var/tmp/{{ config_folder }} /var/tmp/configuration
when: check_path.stat.exists == false
- name: Run requirements file
pip: chdir=/var/tmp/configuration/ requirements=requirements.txt