Commit d3c6cd6b by Michael Roytman

add lifecycle tags and when condition to notifier : Syncdb task

parent 43e60dc9
......@@ -10,6 +10,9 @@
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
tags:
- "install"
- "install:code"
# Optional auth for git
- name: Create ssh script for git (not authenticated)
......@@ -19,6 +22,9 @@
owner: "{{ notifier_user }}"
mode: "0750"
when: NOTIFIER_GIT_IDENTITY == ""
tags:
- "install"
- "install:code"
- name: Create ssh script for git (authenticated)
template:
......@@ -27,6 +33,9 @@
owner: "{{ notifier_user }}"
mode: "0750"
when: NOTIFIER_GIT_IDENTITY != ""
tags:
- "install"
- "install:code"
- name: Install read-only ssh key
copy:
......@@ -36,6 +45,9 @@
owner: "{{ notifier_user }}"
mode: "0600"
when: NOTIFIER_GIT_IDENTITY != ""
tags:
- "install"
- "install:code"
- name: Checkout theme
git:
......@@ -47,6 +59,9 @@
become_user: "{{ notifier_user }}"
environment:
GIT_SSH: "{{ notifier_git_ssh }}"
tags:
- "install"
- "install:code"
- name: Write notifier local settings
template:
......@@ -56,6 +71,9 @@
when: NOTIFIER_THEME_NAME != ''
notify:
- restart notifier-celery-workers
tags:
- "install"
- "install:configuration"
- name: Install application requirements
pip:
......@@ -67,6 +85,9 @@
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
tags:
- "install"
- "install:app-requirements"
# Syncdb for whatever reason always creates the file owned by www-data:www-data, and then
# complains it can't write because it's running as notifier. So this is to touch the file into
......@@ -84,6 +105,8 @@
- restart notifier-celery-workers
tags:
- deploy
- "install"
- "install:configuration"
- name: Syncdb
shell: "{{ NOTIFIER_VENV_DIR }}/bin/python manage.py syncdb"
......@@ -92,6 +115,10 @@
become: true
become_user: "{{ notifier_user }}"
environment: notifier_env_vars
when: migrate_db is defined and migrate_db|lower == "yes"
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
tags:
- "install"
- "install:configuration"
......@@ -21,11 +21,17 @@
name: "{{ item }}"
state: present
with_items: "{{ notifier_debian_pkgs }}"
tags:
- "install"
- "install:system-requirements"
- name: Check if incommon ca is installed
command: "test -e /usr/share/ca-certificates/incommon/InCommonServerCA.crt"
register: incommon_present
ignore_errors: yes
tags:
- "install"
- "install:base"
- name: Create incommon ca directory
file:
......@@ -33,21 +39,33 @@
state: directory
mode: "2775"
when: incommon_present|failed
tags:
- "install"
- "install:base"
- name: Retrieve incommon server CA
get_url:
url: "https://www.incommon.org/cert/repository/InCommonServerCA.txt"
dest: "/usr/share/ca-certificates/incommon/InCommonServerCA.crt"
when: incommon_present|failed
tags:
- "install"
- "install:base"
- name: Add InCommon ca cert
lineinfile:
dest: /etc/ca-certificates.conf
regexp: 'incommon/InCommonServerCA.crt'
line: 'incommon/InCommonServerCA.crt'
tags:
- "install"
- "install:base"
- name: Update ca certs globally
shell: "update-ca-certificates"
tags:
- "install"
- "install:base"
- name: Create notifier user {{ notifier_user }}
user:
......@@ -56,6 +74,9 @@
shell: /bin/false
home: "{{ notifier_app_dir }}"
createhome: no
tags:
- "install"
- "install:base"
- name: Create notifier app dir
file:
......@@ -66,6 +87,9 @@
notify:
- restart notifier-scheduler
- restart notifier-celery-workers
tags:
- "install"
- "install:base"
- name: Setup the notifier env
template:
......@@ -74,6 +98,9 @@
owner: "{{ notifier_user }}"
group: "{{ notifier_user }}"
mode: "0655"
tags:
- "install"
- "install:base"
- name: Drop a bash_profile
copy:
......@@ -81,6 +108,9 @@
dest: "{{ notifier_app_dir }}/.bash_profile"
owner: "{{ notifier_user }}"
group: "{{ notifier_user }}"
tags:
- "install"
- "install:base"
- name: Ensure .bashrc exists
file:
......@@ -88,18 +118,27 @@
state: touch
become: true
become_user: "{{ notifier_user }}"
tags:
- "install"
- "install:base"
- name: Add source of notifier_env to .bashrc
lineinfile:
dest: "{{ notifier_app_dir }}/.bashrc"
regexp: '. {{ notifier_app_dir }}/notifier_env'
line: '. {{ notifier_app_dir }}/notifier_env'
tags:
- "install"
- "install:base"
- name: Add source venv to .bashrc
lineinfile:
dest: "{{ notifier_app_dir }}/.bashrc"
regexp: '. {{ NOTIFIER_VENV_DIR }}/bin/activate'
line: '. {{ NOTIFIER_VENV_DIR }}/bin/activate'
tags:
- "install"
- "install:base"
- name: Create desired directories
file:
......@@ -113,6 +152,9 @@
- { path: '{{ notifier_app_dir }}/bin', owner: '{{ notifier_user }}', group: '{{ notifier_user }}', mode: '2775' }
- { path: '{{ notifier_app_dir }}/.ssh', owner: '{{ notifier_user }}', group: '{{ notifier_user }}', mode: '2700' }
- { path: '{{ COMMON_LOG_DIR }}/notifier', owner: 'syslog', group: 'syslog', mode: '0664' }
tags:
- "install"
- "install:base"
- name: Write supervisord wrapper for celery workers and scheduler
template:
......@@ -122,6 +164,9 @@
become_user: "{{ notifier_user }}"
with_items:
- { src: 'notifier-scheduler-supervisor.sh.j2', dest: '{{ notifier_app_dir }}/notifier-scheduler-supervisor.sh' }
tags:
- "install"
- "install:configuration"
- name: Write supervisord config for celery workers and scheduler
template:
......@@ -132,6 +177,9 @@
with_items:
- { src: 'edx/app/supervisor/conf.d/notifier-celery-workers.conf.j2', dest: '{{ supervisor_available_dir }}/notifier-celery-workers.conf' }
- { src: 'edx/app/supervisor/conf.d/notifier-scheduler.conf.j2', dest: '{{ supervisor_available_dir }}/notifier-scheduler.conf' }
tags:
- "install"
- "install:configuration"
- name: Enable supervisord config for celery workers
file:
......@@ -143,6 +191,9 @@
notify:
- restart notifier-celery-workers
when: not disable_edx_services
tags:
- "install"
- "install:configuration"
- name: Enable supervisord config for scheduler
file:
......@@ -154,6 +205,9 @@
notify:
- restart notifier-scheduler
when: not disable_edx_services
tags:
- "install"
- "install:configuration"
- include: deploy.yml
tags:
......
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