Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: Deploy application
- hosts: all
- become: true
- vars:
- deployment_path: "/home/ubuntu/app"
- compose_path: "./docker-compose.yml"
- roles:
- - geerlingguy.docker
- tasks:
- - name: Update apt-get repo and cache
- apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
- - name: Install packages
- package:
- name:
- - python3-pip
- state: present
- - name: Install docker-compose python package
- pip:
- name:
- - docker<7.0
- - docker-compose
- - name: Create a directory if it does not exist
- file:
- path: "{{ deployment_path }}"
- state: directory
- mode: '0755'
- - name: Copy docker compose
- copy:
- src: "{{ compose_path }}"
- dest: "{{ deployment_path }}"
- - name: Run `docker-compose up`
- become: true
- docker_compose:
- project_src: "{{ deployment_path }}"
- build: yes
- debug: yes
- environment:
- FRONTEND_IMAGE: "{{ lookup('env','FRONTEND_IMAGE') }}"
- BACKEND_IMAGE: "{{ lookup('env','BACKEND_IMAGE') }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement