---
    - command: mktemp
      register: export_csv

    - name: Backup re6st certificates
      command: cp -r /etc/re6stnet /etc/re6stnet.back creates=/etc/re6stnet.back removes=/etc/re6stnet

    - apt: name=sqlite3 state=present update_cache=yes
      when: ansible_os_family == "Debian"

    - yum: name=sqlite state=present update_cache=yes
      when: ansible_os_family == "Centos" or ansible_os_family == "RedHat"

    - name: Dump cache
      shell: sqlite3 -noheader -csv /var/lib/re6stnet/peers.db "select * from peer;" > {{ export_csv.stdout }} removes=/var/lib/re6stnet/peers.db

    - include: debian.yml
      when: ansible_os_family == "Debian"

    - include: rhel.yml
      when: ansible_os_family == "Centos" or ansible_os_family == "RedHat"

    - name: Enable re6stnet service
      service: name=re6stnet enabled=yes

    - command: rm {{ export_csv.stdout }}
