- hosts: localhost tasks: - name: create gitlab home directory file: path: '{{ gitlab_home }}' state: directory mode: '0755' - name: create gitlab app directory become: true file: path: '{{ app_dir }}' state: directory mode: '0755' owner: 'sonny' group: 'sonny' - name: copy docker-compose file template: src: 'templates/docker-compose.j2' dest: '{{ app_dir }}/docker-compose.yml' owner: 'sonny' group: 'sonny' mode: '0755' - name: stop gitlab command: docker compose --file docker-compose.yml down args: chdir: '{{ app_dir }}' environment: GITLAB_HOME: '{{ gitlab_home }}' - name: pull gitlab {{ image_tag }} command: docker compose --file docker-compose.yml pull args: chdir: '{{ app_dir }}' - name: start gitlab command: docker compose --file docker-compose.yml up --detach args: chdir: '{{ app_dir }}' environment: GITLAB_HOME: '{{ gitlab_home }}' - name: reconfigure gitlab command: > docker compose --file docker-compose.yml exec --interactive --tty web gitlab-ctl reconfigure args: chdir: '{{ app_dir }}' environment: GITLAB_HOME: '{{ gitlab_home }}' vars_files: - 'vars/main.yml' - 'vars/email.yml'