|
3 | 3 |
|
4 | 4 | tasks: |
5 | 5 | - name: Clone the repository to a specific version (to a temp location) |
6 | | - git: |
| 6 | + ansible.builtin.git: |
7 | 7 | repo: "{{ repository_url }}" |
8 | 8 | dest: /tmp/src |
9 | | - accept_hostkey: yes |
| 9 | + accept_hostkey: true |
10 | 10 | version: "{{ app_version }}" |
11 | 11 |
|
12 | 12 | - name: Build with a given commit hash |
13 | 13 | # This will be stored in local registry, and available as version to docker-compose |
14 | 14 | # where we can just reference correct version |
15 | | - shell: "cd /tmp/src && make docker/build V={{ app_version }}" |
| 15 | + ansible.builtin.shell: "cd /tmp/src && make docker/build V={{ app_version }}" |
16 | 16 |
|
17 | 17 | - name: Create a server Makefile to manage app tasks |
18 | 18 | ansible.builtin.template: |
19 | | - src: ../templates/app/Makefile.app.j2 |
| 19 | + src: app/Makefile.app.j2 |
20 | 20 | dest: ./Makefile |
| 21 | + mode: "0644" |
21 | 22 |
|
22 | 23 | - name: Set up docker-compose.yml for the app |
23 | 24 | ansible.builtin.template: |
24 | | - src: ../templates/app/docker-compose.app.yml.j2 |
| 25 | + src: app/docker-compose.app.yml.j2 |
25 | 26 | dest: ./docker-compose.yml |
| 27 | + mode: "0644" |
26 | 28 |
|
27 | 29 | - name: Copy env file example |
28 | 30 | ansible.builtin.copy: |
|
34 | 36 | path: intbot.env |
35 | 37 | register: env_file |
36 | 38 |
|
| 39 | + - name: If env file doesn't exist - copy the example |
| 40 | + ansible.builtin.copy: |
| 41 | + src: app/intbot.env.example |
| 42 | + dest: intbot.env.example |
| 43 | + mode: "0644" |
| 44 | + when: not env_file.stat.exists |
| 45 | + |
37 | 46 | - name: If the env file doesn't exist - fail with error message |
38 | 47 | ansible.builtin.fail: |
39 | 48 | msg: "The env file doesn't exist. Please ssh, copy the example and adjust" |
40 | 49 | when: not env_file.stat.exists |
41 | 50 |
|
42 | 51 | - name: Start docker compose to see if everything is running |
43 | | - shell: "docker compose up -d" |
| 52 | + ansible.builtin.shell: "docker compose up -d" |
44 | 53 |
|
45 | 54 | - name: Migrate on prod |
46 | | - shell: "make prod/migrate" |
| 55 | + ansible.builtin.shell: "make prod/migrate" |
47 | 56 |
|
48 | 57 | - name: Restart everything and finish |
49 | | - shell: "docker compose up -d" |
| 58 | + ansible.builtin.shell: "docker compose up -d" |
0 commit comments