---

# from localhost
- name: copy *.deb to dnx-server-repo-intern
  ansible.builtin.copy:
    src: "{{ path_to_debs }}"
    dest: /var/www/repository/debs/
    owner: northtec
    group: northtec
  when: inventory_hostname in groups ['intern']

# on repo-intern.north-tec.net
- name: sign dep package with gpg-key
  ansible.builtin.shell: dpkg-sig --sign builder /var/www/repository/debs/"{{ item }}"
  when: inventory_hostname in groups ['intern']
  loop: "{{ deb_name }}"

- name: prepare dep for repo
  ansible.builtin.shell: reprepro -V --basedir /var/www/repository includedeb trusty /var/www/repository/debs/"{{ item }}"
  when: inventory_hostname in groups ['intern']
  loop: "{{ deb_name }}"
  

- name: sync repo from repo-intern.north-tec.net to repo.dingx.net
  ansible.builtin.shell: rsync -Pvrat /var/www/repository/ northtec@repo.dingx.net:/var/www/repository/ 
  when: inventory_hostname in groups ['intern']

# all servers: make sure /var/www/repository/ has correct user:group
- name: set ownder:group
  ansible.builtin.shell: chown -R northtec:northtec /var/www/repository



