---
- name: get webapp tarball
  get_url:
    url=https://@AZURE_STORAGE_ACCOUNT@.blob.core.windows.net/@CONTAINER_NAME@/webapp.tar.gz
    dest=/tmp/webapp.tar.gz
    remote_src=yes
- name: unarchive webapp directory
  unarchive:
    src=/tmp/webapp.tar.gz
    dest=/home/isucon/
    remote_src=yes
- name: remove webapp tarball
  file:
    path=/tmp/webapp.tar.gz
    state=absent
- name: symoblic link docker-compose.yml
  become_user: isucon
  file:
    src=/home/isucon/webapp/docker-compose-php.yml
    dest=/home/isucon/webapp/docker-compose.yml
    state=link
- name: docker pull
  command: docker pull {{ item }}
  become_user: isucon
  with_items:
    - mysql
    - nginx:alpine
- name: docker build
  command: chdir="/home/isucon/webapp/{{ item }}" docker build .
  become_user: isucon
  with_items:
    - php
    - react
- name: place the file of systemd
  copy:
    src=etc/systemd/system/isu.service
    dest=/etc/systemd/system/isu.service
    owner=root
    mode=644
  notify: reload systemctl
- name: running default application
  service: name=isu state=restarted enabled=true
- pause: seconds=10

---
- name: unarchive webapp directory
  unarchive: src=https://@AZURE_STORAGE_ACCOUNT@.blob.core.windows.net/@CONTAINER_NAME@/webapp.tar.gz dest=/home/isucon/ remote_src=yes
- name: symoblic link docker-compose.yml
  become_user: isucon
  file:
    src=/home/isucon/webapp/docker-compose-php.yml
    dest=/home/isucon/webapp/docker-compose.yml
    state=link
- name: docker pull
  command: docker pull {{ item }}
  become_user: isucon
  with_items:
    - mysql
    - nginx:alpine
- name: docker build
  command: chdir="/home/isucon/webapp/{{ item }}" docker build .
  become_user: isucon
  with_items:
    - php
    - react
- name: place the file of systemd
  copy:
    src=etc/systemd/system/isu.service
    dest=/etc/systemd/system/isu.service
    owner=root
    mode=644
  notify: reload systemctl
- name: running default application
  service: name=isu state=restarted enabled=true
- pause: seconds=10

Revert "use get_url for download webapp tarball"
Revert "use get_url for download webapp tarball"

This reverts commit 6d1b9450e04abda988cff73eec621309c4b4d2e8.
