# tasks file for dist_repo
- name: create distribution repository for ecu packages
block:
- name: create Packages description
shell: "dpkg-scanpackages -m . | gzip -c9 > Packages.gz"
args:
chdir: "{{local_debian_dir}}"
creates: "{{local_debian_dir}}/Packages.gz"
changed_when: false
delegate_to: localhost
- name: "create remote upload dir {{remote_debian_dir}}"
file:
path: "{{remote_debian_dir}}"
state: directory
changed_when: false
- name: "find all files in {{local_debian_dir}}"
find:
paths: "{{local_debian_dir}}"
file_type: file
depth: 1
register: result
delegate_to: localhost
- name: copy debian packages
copy:
src: "{{item.path}}"
dest: "{{remote_debian_dir}}"
directory_mode: yes
changed_when: false
with_items: "{{result.files}}"
- name: create file debian repo
template:
src: "source.list"
dest: "/etc/apt/sources.list.d/ansible.list"
changed_when: false
- name: update apt cache
apt:
update_cache: "{{update_cache}}"
changed_when: false
when: state == "present"
- name: remove distribution repository for ecu packages
block:
- name: "remove {{remote_debian_dir}}"
file:
path: "{{remote_debian_dir}}"
state: absent
changed_when: false
- name: "remove /etc/apt/sources.list.d/ansible.list"
file:
path: "/etc/apt/sources.list.d/ansible.list"
state: absent
changed_when: false
when: state == "absent"