Commit 757fbcb1 by e0d

Merge pull request #724 from edx/e0d/automating-edxapp

E0d/automating edxapp
parents 1065e035 904cdf80
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6noLNy7YVFNK6OSOFgPbnGGovgZqLsvJxjhs82jT7tZIsYOjVVCAMk0kkSnBt0etDjGSJlJ664r1aBhubZrujzxns0oOzA7J+tWQ3CiaOBLtOSffeh8a3dTWWNPCAGg9KflPaufXdd31Bf96g9ACGZR7uLYgWUP/J0jOPMCPE1RBfRNFeZ7cHlh3t/pI+JzTcyZTka4AAEsCejBKHngYxVoOk+gfxe+Qo703st0MFuoxVAMymeBGi/1lCwKsV6r9BijzuvIFyQCl2vThjoF32yHmmP8by//hmgpo5UNqG7jbmSrCJhkdh+My3SgEebn5c2QLJepOrUfrZFwz1BQ1l task@edx.org
\ No newline at end of file
...@@ -61,10 +61,6 @@ ...@@ -61,10 +61,6 @@
user: user:
name={{ automated_user }} state=present shell=/bin/rbash name={{ automated_user }} state=present shell=/bin/rbash
home={{ automated_home }} createhome=yes home={{ automated_home }} createhome=yes
tags:
- automated
- install
- update
- name: create sudoers file from file - name: create sudoers file from file
copy: copy:
...@@ -72,10 +68,6 @@ ...@@ -72,10 +68,6 @@
src={{ automated_sudoers_file }} owner="root" src={{ automated_sudoers_file }} owner="root"
group="root" mode=0440 validate='visudo -cf %s' group="root" mode=0440 validate='visudo -cf %s'
when: automated_sudoers_file when: automated_sudoers_file
tags:
- automated
- install
- update
- name: create sudoers file from template - name: create sudoers file from template
template: template:
...@@ -83,10 +75,6 @@ ...@@ -83,10 +75,6 @@
src={{ automated_sudoers_template }} owner="root" src={{ automated_sudoers_template }} owner="root"
group="root" mode=0440 validate='visudo -cf %s' group="root" mode=0440 validate='visudo -cf %s'
when: automated_sudoers_template when: automated_sudoers_template
tags:
- automated
- install
- update
# #
# Prevent user from updating their PATH and # Prevent user from updating their PATH and
...@@ -96,10 +84,6 @@ ...@@ -96,10 +84,6 @@
file: file:
path={{ automated_home }}/{{ item }} mode=0640 path={{ automated_home }}/{{ item }} mode=0640
state=file owner="root" group={{ automated_user }} state=file owner="root" group={{ automated_user }}
tags:
- automated
- install
- update
with_items: with_items:
- .bashrc - .bashrc
- .profile - .profile
...@@ -109,10 +93,6 @@ ...@@ -109,10 +93,6 @@
file: file:
path={{ automated_home }} mode=0750 state=directory path={{ automated_home }} mode=0750 state=directory
owner="root" group={{ automated_user }} owner="root" group={{ automated_user }}
tags:
- automated
- install
- update
# #
# This ensures that the links are updated with each run # This ensures that the links are updated with each run
...@@ -123,19 +103,11 @@ ...@@ -123,19 +103,11 @@
file: file:
path={{ automated_home }}/bin state=absent path={{ automated_home }}/bin state=absent
ignore_errors: yes ignore_errors: yes
tags:
- automated
- install
- update
- name: create ~automated/bin directory - name: create ~automated/bin directory
file: file:
path={{ automated_home }}/bin state=directory mode=0750 path={{ automated_home }}/bin state=directory mode=0750
owner="root" group={{ automated_user }} owner="root" group={{ automated_user }}
tags:
- automated
- install
- update
- name: re-write .profile - name: re-write .profile
copy: copy:
...@@ -144,10 +116,6 @@ ...@@ -144,10 +116,6 @@
owner="root" owner="root"
group={{ automated_user }} group={{ automated_user }}
mode="0744" mode="0744"
tags:
- automated
- install
- update
- name: re-write .bashrc - name: re-write .bashrc
copy: copy:
...@@ -156,36 +124,20 @@ ...@@ -156,36 +124,20 @@
owner="root" owner="root"
group={{ automated_user }} group={{ automated_user }}
mode="0744" mode="0744"
tags:
- automated
- install
- update
- name: create .ssh directory - name: create .ssh directory
file: file:
path={{ automated_home }}/.ssh state=directory mode=0700 path={{ automated_home }}/.ssh state=directory mode=0700
owner={{ automated_user }} group={{ automated_user }} owner={{ automated_user }} group={{ automated_user }}
tags:
- automated - name: build authorized_keys file
- install template:
- update src=home/automator/.ssh/authorized_keys.j2
- name: copy key to .ssh/authorized_keys
copy:
src=home/automator/.ssh/authorized_keys
dest={{ automated_home }}/.ssh/authorized_keys mode=0600 dest={{ automated_home }}/.ssh/authorized_keys mode=0600
owner={{ automated_user }} group={{ automated_user }} owner={{ automated_user }} group={{ automated_user }}
tags:
- automated
- install
- update
- name: create allowed command links - name: create allowed command links
file: file:
src={{ item }} dest={{ automated_home }}/bin/{{ item.split('/').pop() }} src={{ item }} dest={{ automated_home }}/bin/{{ item.split('/').pop() }}
state=link state=link
with_items: automated_rbash_links with_items: automated_rbash_links
tags: \ No newline at end of file
- automated
- install
- update
...@@ -123,6 +123,13 @@ EDXAPP_PYTHON_SANDBOX: false ...@@ -123,6 +123,13 @@ EDXAPP_PYTHON_SANDBOX: false
# it puts the sandbox in 'complain' mode, for reporting but not enforcement # it puts the sandbox in 'complain' mode, for reporting but not enforcement
EDXAPP_SANDBOX_ENFORCE: true EDXAPP_SANDBOX_ENFORCE: true
# Supply authorized keys used for remote management via the automated
# role, see meta/main.yml. Ensure you know what this does before
# enabling. The boolean flag determines whether the role is included.
# This is done to make it possible to disable remote access easily by
# setting the flag to true and providing an empty array.
EDXAPP_INCLUDE_AUTOMATOR_ROLE: false
EDXAPP_AUTOMATOR_AUTHORIZED_KEYS: []
#-------- Everything below this line is internal to the role ------------ #-------- Everything below this line is internal to the role ------------
...@@ -497,3 +504,9 @@ edxapp_cms_variant: cms ...@@ -497,3 +504,9 @@ edxapp_cms_variant: cms
# Worker Settings # Worker Settings
worker_django_settings_module: 'aws' worker_django_settings_module: 'aws'
# This array is used by the automator role to provide
# access to a limited set of commands via rbash. The
# commands listed here will be symlinked to ~/bin/ for
# the automator user.
edxapp_automated_rbash_links:
- /usr/bin/sudo
\ No newline at end of file
...@@ -6,3 +6,9 @@ dependencies: ...@@ -6,3 +6,9 @@ dependencies:
rbenv_dir: "{{ edxapp_app_dir }}" rbenv_dir: "{{ edxapp_app_dir }}"
rbenv_ruby_version: "{{ edxapp_ruby_version }}" rbenv_ruby_version: "{{ edxapp_ruby_version }}"
- devpi - devpi
- role: automated
automated_rbash_links: "{{ edxapp_automated_rbash_links }}"
automated_sudoers_dest: '99-automator-edxapp-server'
automated_sudoers_template: 'roles/edxapp/templates/etc/sudoers.d/99-automator-edxapp-server.j2'
automated_authorized_keys: "{{ EDXAPP_AUTOMATOR_AUTHORIZED_KEYS }}"
when: EDXAPP_INCLUDE_AUTOMATOR_ROLE
automator ALL=({{ common_web_user }}) NOPASSWD:SETENV:{{ edxapp_venv_dir }}/bin/django-admin.py migrate *
automator ALL=({{ common_web_user }}) NOPASSWD:SETENV:{{ edxapp_venv_dir }}/bin/django-admin.py seed_permissions_roles *
automator ALL=({{ common_web_user }}) NOPASSWD:SETENV:{{ edxapp_venv_dir }}/bin/django-admin.py set_staff *
automator ALL=({{ common_web_user }}) NOPASSWD:SETENV:{{ edxapp_venv_dir }}/bin/django-admin.py transfer_students *
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment