---
- name: Create JTLShop 4 database
  mysql_db: name={{ jtlshop4_db_name }} state=present
  become: yes

- name: Create JTLShop 4 database user
  mysql_user: name={{ jtlshop4_db_user }} password={{ jtlshop4_db_pass }} priv={{ jtlshop4_db_name }}.*:ALL state=present
  become: yes

- name: Create JTLShop {{ jtlshop4_version }} install directory
  file: path={{ jtlshop4_install_path }} owner=vagrant group=users state=directory
  become: yes

- name: Download JTLShop CLI
  get_url: url="http://jtl-url.de/shopcli-latest" dest={{ web_root }}/shopcli
- file: path={{ web_root }}/shopcli state=touch mode=u+xwr

- name: Install JTLShop {{ jtlshop4_version }}
  command: "{{ web_root }}/shopcli shop:install --target-dir={{ jtlshop4_install_path }} --target-version={{ jtlshop4_version }} --database-host=localhost --database-name={{ jtlshop4_db_name }} --database-user={{ jtlshop4_db_user }} --database-password={{ jtlshop4_db_pass }} --admin-user=demo --admin-password=demo --install-demo-data"
  args:
    creates: "{{ jtlshop4_install_path }}/jtl.php"

---
- name: install npm
  apt: pkg={{ item }} state=latest
  become: yes
  with_items:
    - nodejs
    - npm
    - nodejs-legacy

- name: install grunt-cli globally
  command: npm install -g grunt-cli bower
  become: yes

- name: Create JTLShop 4 database
  mysql_db: name={{ jtlshop4_db_name }} state=present
  become: yes

- name: Create JTLShop 4 database user
  mysql_user: name={{ jtlshop4_db_user }} password={{ jtlshop4_db_pass }} priv={{ jtlshop4_db_name }}.*:ALL state=present
  become: yes

- name: Create JTLShop {{ jtlshop4_version }} install directory
  file: path={{ jtlshop4_install_path }} owner=vagrant group=users state=directory
  become: yes

- name: Download JTLShop CLI
  get_url: url="http://jtl-url.de/shopcli-latest" dest={{ web_root }}/shopcli
- file: path={{ web_root }}/shopcli state=touch mode=u+xwr

- name: Install JTLShop {{ jtlshop4_version }}
  command: "{{ web_root }}/shopcli shop:install --target-dir={{ jtlshop4_install_path }} --target-version={{ jtlshop4_version }} --database-host=localhost --database-name={{ jtlshop4_db_name }} --database-user={{ jtlshop4_db_user }} --database-password={{ jtlshop4_db_pass }} --admin-user=demo --admin-password=demo --install-demo-data"
  args:
    creates: "{{ jtlshop4_install_path }}/jtl.php"

Install dependencies for our custom theme development.
Install dependencies for our custom theme development.
