---
- import_tasks: tasks/apt_install.yml
- import_tasks: tasks/ufw_tcp.yml

- import_tasks: mariadb.yml

- name: Copy apache config
  copy: src=000-default.conf
        dest=/etc/apache2/sites-available/
        owner=root
        group=root
        mode=655

- name: Clone repository
  git: repo=https://git.2li.ch/ibz/web_AI-5.git
       dest="/vagrant"
       force=yes
       version=production

- name: Set Permissions on the repository
  file:
    dest=/vagrant
    owner=ansible group=ansible
    recurse=yes

- name: Install pip packages
  pip:
    name:
      - django-extensions
      - Pillow
      - pyaml
      - django-bootstrap3
    executable: pip3

- name: Run the setup script to add some final touches
  shell: "/vagrant/ansible/roles/web_AI-5/tasks/setup_script.sh"

- name: Creates directory
  file:
    path: /srv/media
    state: directory
    owner: www-data
    group: www-data
    mode: 0755


- name: Add currency refresh cronjob
  cron:
    name: "refresh currencies"
    minute: "0"
    job: "wget -O /dev/null https://didgeridoo.ml/currencies"


- name: Restart apache service
  service: name=apache2 state=restarted
