deploy.yml 2.8 KB
Newer Older
bow's avatar
bow committed
1
2
3
4
5
---

- name: create required directories
  file: path={{ item }} owner={{ sentinel_user }} group={{ sentinel_group }} state=directory mode=0755
  with_items:
bow's avatar
bow committed
6
    - "{{ sentinel_checkout_dir|dirname }}"
bow's avatar
bow committed
7
    - "{{ sentinel_deployment_dir }}"
8
    - "{{ sentinel_nginx_dir }}"
bow's avatar
bow committed
9
10
11
12
13
14
15
16

- name: clone git repository
  git:
    repo: "{{ sentinel_git_repo }}"
    dest: "{{ sentinel_checkout_dir }}"
    version: "{{ sentinel_git_checkout }}"
    update: yes
  become_user: "{{ sentinel_user }}"
bow's avatar
bow committed
17
  register: gitclone
bow's avatar
bow committed
18

bow's avatar
bow committed
19
- name: install pip
bow's avatar
bow committed
20
21
22
23
24
25
  apt: pkg={{ item }} state=present
  with_items:
    - python-dev
    - python-pip

- name: ensure requirements file exists
26
  stat: path={{ sentinel_checkout_dir }}/requirements-dev.txt
bow's avatar
bow committed
27
28
29

- name: install python dependencies
  pip:
30
    chdir: "{{ sentinel_checkout_dir }}"
bow's avatar
bow committed
31
32
    requirements: "requirements-dev.txt"

33
- name: install dependencies via sbt (first run may take a while)
bow's avatar
bow committed
34
  shell: "./sbt -batch -no-colors update"
bow's avatar
bow committed
35
  args:
36
    chdir: "{{ sentinel_checkout_dir }}"
bow's avatar
bow committed
37
38
39
  become_user: "{{ sentinel_user }}"
  register: sbt_update
  changed_when: "'ownloading' in sbt_update.stdout"
bow's avatar
bow committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

- name: capture scala series
  shell: "./sbt -batch -no-colors 'show sentinel/scalaSeries'"
  args:
    chdir: "{{ sentinel_checkout_dir }}"
  become_user: "{{ sentinel_user }}"
  register: cmd_scala_series
  changed_when: false

- name: capture sentinel version
  shell: "./sbt -batch -no-colors 'show sentinel/version'"
  args:
    chdir: "{{ sentinel_checkout_dir }}"
  become_user: "{{ sentinel_user }}"
  register: cmd_sentinel_version
  changed_when: false

- name: store scala series
  set_fact: scala_series="{{ cmd_scala_series.stdout_lines|last|replace('[info] ', '') }}"
  when: cmd_scala_series|success

- name: store sentinel version
  set_fact: sentinel_version="{{ cmd_sentinel_version.stdout_lines|last|replace('[info] ', '') }}"
  when: cmd_sentinel_version|success

65
66
67
- include: deploy_db.yml
  tags: [sentinel, deploy]

bow's avatar
bow committed
68
69
70
- include: deploy_jar.yml
  tags: [sentinel, deploy]

71
72
- include: deploy_docs.yml
  tags: [sentinel, deploy]
73
74

- name: set nginx configuration
bow's avatar
bow committed
75
  template: src=sentinel.nginx.j2 dest=/etc/nginx/sites-available/sentinel
76
77
  register: nginx_config

bow's avatar
bow committed
78
79
80
- name: disable default nginx configuration
  file: path=/etc/nginx/sites-enabled/default state=absent

81
82
83
84
- name: enable sentinel nginx configuration
  file: path=/etc/nginx/sites-enabled/sentinel src=/etc/nginx/sites-available/sentinel state=link
  when: nginx_config|changed

bow's avatar
bow committed
85
86
87
- name: (re)start nginx
  service: name=nginx state=restarted enabled=yes
  when: nginx_config|changed
88

bow's avatar
bow committed
89
90
91
- name: ensure scaladoc page is up
  uri: url=http://127.0.0.1/scaladoc/index.html

92
- name: ensure guide page up
bow's avatar
bow committed
93
94
  uri: url=http://127.0.0.1/guide/index.html

95
- name: wait sentinel startup
96
97
  wait_for: host=127.0.0.1 port=8080

bow's avatar
bow committed
98
- name: ensure api-docs page is up
bow's avatar
bow committed
99
  uri: url=http://127.0.0.1/api-docs/