Commit d3c6cd6b by Michael Roytman

add lifecycle tags and when condition to notifier : Syncdb task

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