---
# tasks file for pelican-gitreceive
- name: Assertions
  assert:
    that:
        - ansible_os_family in pelican_gitreceive_www_root
        - ansible_distribution_release in ['6.0', 'xenial', 'trusty', 'jessie']
        - pelican_gitreceive_public_keys is iterable
        - pelican_gitreceive_output is defined

- name: APT install prerequisites
  when: ansible_pkg_mgr == 'apt'
  apt:
      name: python-dev
      state: present
      update_cache: yes
      cache_valid_time: 3600

- name: pip install
  with_items:
      - pelican
      - fabric
  pip:
      name: '{{ item }}'
      state: present

- name: Create directory structure
  file:
      path: '{{ pelican_gitreceive_www_root[ansible_os_family] }}/blog/'
      owner: git
      group: git
      state: directory
      mode: 0o0755
