aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/roles/my_server/tasks/main.yml
blob: eaf6aa5957c12995c012d953612422a17ec073d6 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                             
              
                       


                                               

                                 
              
                                                                          
                          


                                                      

                             
- name: 'Check if {{ server_dir }}/docker-compose.yml exists'
  become: true
  ansible.builtin.stat:
    path: '{{ server_dir }}/docker-compose.yml'
  register: server_exists

- name: Update containers
  when: server_exists.stat.exists
  become: true
  # community.docker.docker_compose is too confusing for me to use, sorry.
  ansible.builtin.shell: |
    docker-compose pull -q && \
        docker-compose build --force-rm --pull -q && \
        docker-compose up --remove-orphans -d
  args:
    chdir: '{{ server_dir }}'