public-health-ch/ansible/roles/wagtail/tasks/frontend.yaml

61 lines
1.4 KiB
YAML

---
- name: Create release directory
file: path={{ release_dir }} state=directory owner=ansible group=ansible
become: true
- name: Create static directory
file: path={{ release_dir }}/static state=directory owner=ansible group=www-data
become: true
- name: Set static directory permissions
file: dest={{ release_dir }}/static owner=ansible group=www-data mode=u=rwX,g=rX,o=rX recurse=yes
become: true
- name: Install JavaScript Yarn
become: true
npm:
name: yarn
global: true
- name: Link the Yarn executable
become: true
file:
src: "/usr/local/lib/npm/bin/yarn"
dest: "/usr/local/bin/yarn"
state: link
- name: Install JavaScript Grunt
become: true
yarn:
name: grunt-cli
global: true
- name: Link the Grunt executable
become: true
file:
src: "/usr/local/lib/npm/bin/grunt"
dest: "/usr/local/bin/grunt"
state: link
- name: Install JavaScript packages with Yarn
yarn:
path: "{{ release_dir }}"
- name: Create libs directory
file:
path: "{{ release_dir }}/publichealth/static/libs/"
state: directory
- name: Copy bower components to libs
copy:
src: "{{ release_dir }}/node_modules/@bower_components/"
dest: "{{ release_dir }}/publichealth/static/libs/"
remote_src: yes
force: yes
- name: Compile JavaScript sources with Grunt
shell: grunt
args:
chdir: "{{ release_dir }}"