forked from openedx-unsupported/configuration
/
main.yml
122 lines (110 loc) · 3.13 KB
/
main.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
112
113
114
115
116
117
118
119
120
121
122
---
- name: Install useful system packages
apt:
name: "{{ item }}"
install_recommends: yes
state: present
update_cache: yes
with_items: "{{ local_dev_pkgs }}"
- name: Set login shell for app accounts
user:
name: "{{ item.user }}"
shell: "/bin/bash"
with_items: "{{ localdev_accounts }}"
when: item.user != 'None'
# The user that runs the app needs read/write permissions
# to the directories under var to be able to import and create
# new courses.
- name: Update permissions for edxapp data dir
file:
path: "{{ edxapp_data_dir }}"
state: "directory"
recurse: yes
owner: "{{ edxapp_user }}"
group: "{{ common_web_group }}"
when: edxapp_user is defined
# Create scripts to configure environment
- name: Create login scripts
template:
src: app_bashrc.j2
dest: "{{ item.home }}/.bashrc"
owner: "{{ item.user }}"
mode: "0755"
with_items: "{{ localdev_accounts }}"
when: item.user != 'None'
ignore_errors: yes
# Default to the correct git config
# No more accidentally force pushing to master! :)
- name: Configure git
copy:
src: gitconfig
dest: "{{ item.home }}/.gitconfig"
owner: "{{ item.user }}"
mode: "0700"
with_items: "{{ localdev_accounts }}"
when: item.user != 'None'
ignore_errors: yes
# Configure X11 for application users
- name: Preserve DISPLAY for sudo
copy:
src: x11_display
dest: /etc/sudoers.d/x11_display
owner: root
group: root
mode: "0440"
- name: Login share X11 auth to app users
template:
src: share_x11.j2
dest: "{{ localdev_home }}/share_x11"
owner: "{{ localdev_user }}"
mode: "0700"
- name: Update bashrc with X11 share script
lineinfile:
dest: "{{ localdev_home }}/.bashrc"
regexp: ". {{ localdev_home }}/share_x11"
line: ". {{ localdev_home }}/share_x11"
state: present
# Create a .bashrc.d directory to hold extra bash initializations
- name: Create .bashrc.d dir
file:
path: "{{ item.home }}/.bashrc.d"
owner: "{{ item.user }}"
group: "{{ common_web_group }}"
state: directory
with_items: "{{ localdev_accounts }}"
when: item.user != 'None'
# Add useful vimrc files
- name: Create .vim/plugin directory
file:
path: "{{ item.home }}/.vim/ftplugin"
owner: "{{ item.user }}"
group: "{{ common_web_group }}"
state: directory
with_items: "{{ localdev_accounts }}"
when: item.user != 'None'
- name: Add .vimrc file
copy:
src: vimrc
dest: "{{ item.home }}/.vimrc"
owner: "{{ item.user }}"
group: "{{ common_web_group }}"
mode: "0644"
with_items: "{{ localdev_accounts }}"
when: item.user != 'None'
- name: Add python.vim ftplugin file
copy:
src: ftplugin-python.vim
dest: "{{ item.home }}/.vim/ftplugin/python.vim"
owner: "{{ item.user }}"
group: "{{ common_web_group }}"
mode: "0644"
with_items: "{{ localdev_accounts }}"
when: item.user != 'None'
# Edit the /etc/hosts file so that the Preview button will work in Studio
- name: Add preview.localhost to /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: "^127.0.0.1"
line: "127.0.0.1 localhost preview.localhost"
state: present
become: yes