aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/my_server/tasks/main.yml
blob: d88bb8653b0c7ff717992b49729794a2dc0865be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- name: 'Check if {{ server_dir }}/docker-compose.yml exists'
  become: true
  stat:
    path: '{{ server_dir }}/docker-compose.yml'
  register: server_exists

- when: server_exists.stat.exists
  become: true
  block:
    # community.docker.docker_compose is too confusing for me to use, sorry.
    - name: docker-compose pull
      command: docker-compose pull --quiet
      args:
        chdir: '{{ server_dir }}'

    - name: docker-compose build
      command: docker-compose build --pull
      args:
        chdir: '{{ server_dir }}'

    - name: docker-compose up
      command: docker-compose up -d
      args:
        chdir: '{{ server_dir }}'