|
|
|
@ -1,22 +1,48 @@
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# - name: Repository is checked-out
|
|
|
|
|
# git:
|
|
|
|
|
# repo: 'https://github.com/Evolix/chexpire.git'
|
|
|
|
|
# dest: "{{ chexpire_app_directory }}"
|
|
|
|
|
#
|
|
|
|
|
# - name: Bundle dependencies are installed
|
|
|
|
|
# bundler:
|
|
|
|
|
# executable: ~/.rbenv/shims/bundle
|
|
|
|
|
# chdir: "{{ chexpire_app_directory }}"
|
|
|
|
|
# state: present
|
|
|
|
|
# deployment_mode: yes
|
|
|
|
|
#
|
|
|
|
|
# - name: Yarn dependencies are installed
|
|
|
|
|
# command: "yarn install --check-files"
|
|
|
|
|
# args:
|
|
|
|
|
# chdir: "{{ chexpire_app_directory }}"
|
|
|
|
|
- name: Repository is checked-out
|
|
|
|
|
git:
|
|
|
|
|
repo: 'https://github.com/Evolix/chexpire.git'
|
|
|
|
|
dest: "{{ chexpire_app_directory }}"
|
|
|
|
|
update: no
|
|
|
|
|
|
|
|
|
|
- name: Bundle dependencies are installed
|
|
|
|
|
bundler:
|
|
|
|
|
executable: ~/.rbenv/shims/bundle
|
|
|
|
|
chdir: "{{ chexpire_app_directory }}"
|
|
|
|
|
state: present
|
|
|
|
|
deployment_mode: yes
|
|
|
|
|
|
|
|
|
|
- name: Yarn dependencies are installed
|
|
|
|
|
command: "yarn install --check-files"
|
|
|
|
|
args:
|
|
|
|
|
chdir: "{{ chexpire_app_directory }}"
|
|
|
|
|
|
|
|
|
|
- name: read .my.cnf file for password
|
|
|
|
|
shell: cat /home/vagrant/.my.cnf | grep password | cut -d '=' -f2 | xargs
|
|
|
|
|
changed_when: False
|
|
|
|
|
register: _result
|
|
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
|
mysql_chexpire_password: "{{ _result.stdout }}"
|
|
|
|
|
|
|
|
|
|
- name: .rbenv-vars file is initialized
|
|
|
|
|
lineinfile:
|
|
|
|
|
dest: "{{ chexpire_app_directory }}/.rbenv-vars"
|
|
|
|
|
line: "{{ item.key }}={{ item.value }}"
|
|
|
|
|
regexp: "^{{ item.key }}="
|
|
|
|
|
create: True
|
|
|
|
|
with_items:
|
|
|
|
|
- { key: "WEB_CONCURRENCY", value: "1" }
|
|
|
|
|
- { key: "DATABASE_URL", value: "mysql2://{{ mysql_chexpire_username }}:{{ mysql_chexpire_password }}@127.0.0.1/{{ mysql_chexpire_db }}" }
|
|
|
|
|
- { key: "PORT", value: "{{ puma_port }}" }
|
|
|
|
|
|
|
|
|
|
- name: .ruby-version file is initialized
|
|
|
|
|
copy:
|
|
|
|
|
dest: "{{ chexpire_app_directory }}/.ruby-version"
|
|
|
|
|
content: "{{ ruby_version }}"
|
|
|
|
|
force: yes
|
|
|
|
|
|
|
|
|
|
- name: Chexpire config file is present
|
|
|
|
|
template:
|
|
|
|
@ -24,20 +50,50 @@
|
|
|
|
|
src: chexpire.yml.j2
|
|
|
|
|
force: no
|
|
|
|
|
|
|
|
|
|
- name: Database config file is copied
|
|
|
|
|
command: "cp {{ chexpire_app_directory }}/config/database.example.yml {{ chexpire_app_directory }}/config/database.yml"
|
|
|
|
|
args:
|
|
|
|
|
creates: "{{ chexpire_app_directory }}/config/database.yml"
|
|
|
|
|
- name: Database config file is present
|
|
|
|
|
template:
|
|
|
|
|
dest: "{{ chexpire_app_directory }}/config/database.yml"
|
|
|
|
|
src: database.yml.j2
|
|
|
|
|
force: yes
|
|
|
|
|
|
|
|
|
|
- name: Secret key base is generated
|
|
|
|
|
command: ~/.rbenv/shims/bundle exec rails secret
|
|
|
|
|
register: secret_key_base
|
|
|
|
|
command: "~/.rbenv/shims/bundle exec rails secret"
|
|
|
|
|
args:
|
|
|
|
|
chdir: "{{ chexpire_app_directory }}"
|
|
|
|
|
creates: "{{ chexpire_app_directory }}/config/secrets.yml"
|
|
|
|
|
creates: "config/secrets.yml"
|
|
|
|
|
register: secret_key_base
|
|
|
|
|
|
|
|
|
|
- name: Secret key is in the secrets file
|
|
|
|
|
template:
|
|
|
|
|
dest: "{{ chexpire_app_directory }}/config/secrets.yml"
|
|
|
|
|
src: secrets.yml.j2
|
|
|
|
|
force: no
|
|
|
|
|
|
|
|
|
|
# - name: Check migrations status
|
|
|
|
|
# command: "~/.rbenv/shims/bundle exec rails db:migrate:status"
|
|
|
|
|
# failed_when: False
|
|
|
|
|
# changed_when: False
|
|
|
|
|
# args:
|
|
|
|
|
# chdir: "{{ chexpire_app_directory }}"
|
|
|
|
|
# register: db_migrate_status
|
|
|
|
|
|
|
|
|
|
- name: Migration are applied
|
|
|
|
|
command: "~/.rbenv/shims/bundle exec rails db:migrate"
|
|
|
|
|
args:
|
|
|
|
|
chdir: "{{ chexpire_app_directory }}"
|
|
|
|
|
register: db_migrate
|
|
|
|
|
# when: db_migrate_status.rc != 0
|
|
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
|
var: db_migrate
|
|
|
|
|
verbosity: 3
|
|
|
|
|
#
|
|
|
|
|
# - name: DB is prepared
|
|
|
|
|
# command: "~/.rbenv/shims/bundle exec rails db:prepare"
|
|
|
|
|
# args:
|
|
|
|
|
# chdir: "{{ chexpire_app_directory }}"
|
|
|
|
|
# register: db_prepare
|
|
|
|
|
#
|
|
|
|
|
# - debug:
|
|
|
|
|
# var: db_prepare
|
|
|
|
|
# verbosity: 3
|
|
|
|
|