main.yml 2.97 KB
Newer Older
1
---
2
- name: install useful system packages
3 4 5 6
  apt:
    pkg={{','.join(local_dev_pkgs)}} install_recommends=yes
    state=present update_cache=yes

7
- name: set login shell for app accounts
8
  user: name={{ item.user }} shell="/bin/bash"
9
  with_items: localdev_accounts
10
  when: item.user != 'None'
11 12 13 14

# Ensure forum user has permissions to access .gem and .rbenv
# This is a little twisty: the forum role sets the owner and group to www-data
# So we add the forum user to the www-data group and give group write permissions
15
- name: add forum user to www-data group
16
  user: name={{ forum_user }} groups={{ common_web_group }} append=yes
17
  when: forum_user is defined
18

19 20 21
# Need this in order for the forum user to install and uninstall
# gems using 'bundle' or 'gem'.  Can't make it 760 because that
# would break the bin directory under .gem
22
- name: set forum rbenv and gem permissions
23
  file:
24
    path={{ item }} state=directory recurse=yes mode="g+rw"
25 26
  with_items:
    - "{{ forum_app_dir }}/.gem"
27
  when: forum_user is defined
28 29

# Create scripts to configure environment
30
- name: create login scripts
31
  template:
32
    src=app_bashrc.j2 dest={{ item.home }}/.bashrc
33
    owner={{ item.user }} mode=755
34
  with_items: localdev_accounts
35
  when: item.user != 'None'
36
  ignore_errors: yes
37 38 39

# Default to the correct git config
# No more accidentally force pushing to master! :)
40
- name: configure git
41 42 43
  copy:
    src=gitconfig dest={{ item.home }}/.gitconfig
    owner={{ item.user }} mode=700
44
  with_items: localdev_accounts
45
  when: item.user != 'None'
46
  ignore_errors: yes
47 48

# Configure X11 for application users
49
- name: preserve DISPLAY for sudo
50 51 52 53
  copy:
    src=x11_display dest=/etc/sudoers.d/x11_display
    owner=root group=root mode=0440

54
- name: login share X11 auth to app users
55 56 57 58
  template:
    src=share_x11.j2 dest={{ localdev_home }}/share_x11
    owner={{ localdev_user }} mode=0700

59
- name: update bashrc with X11 share script
60 61 62 63 64
  lineinfile:
    dest={{ localdev_home }}/.bashrc
    regexp=". {{ localdev_home }}/share_x11"
    line=". {{ localdev_home }}/share_x11"
    state=present
Minh Tue Vo committed
65 66 67 68 69 70

# Create scripts to add paver autocomplete
- name: add paver autocomplete
  template:
    src=paver_autocomplete dest={{ item.home }}/.paver_autocomplete
    owner={{ item.user }} mode=755
71
  with_items: localdev_accounts
72
  when: item.user != 'None'
73
  ignore_errors: yes
74 75 76 77 78

# Edit the /etc/hosts file so that the Preview button will work in Studio
- name: add preview.localhost to /etc/hosts
  shell: sed -i -r 's/^127.0.0.1\s+.*$/127.0.0.1 localhost preview.localhost/' /etc/hosts
  sudo: yes
Renzo Lucioni committed
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93

- name: create OAuth2 Clients
  shell: >
    {{ COMMON_BIN_DIR }}/python.edxapp {{ COMMON_BIN_DIR }}/manage.edxapp lms --settings=aws
    create_oauth2_client
    {{ item.url_root }}
    "{{ item.url_root }}/complete/edx-oidc/"
    confidential
    --client_name {{ item.name }}
    --client_id {{ item.id }}
    --client_secret {{ item.secret }}
    --trusted
  sudo_user: "{{ edxapp_user }}"
  environment: "{{ edxapp_environment }}"
  with_items: localdev_oauth2_clients