- block: - name: Install needed packages apt: name: "{{ item }}" with_items: - dpkg-dev - equivs - libfile-fcntllock-perl # to silence warning by equivs-build - set_fact: repodir: /tmp/repo/ - name: Create repo dirs file: path: "{{ repodir }}/dists/{{ item }}/main/binary-all" state: directory mode: 0755 loop: - stable - testing - name: Copy package specs to remote copy: src: package_specs dest: "{{ remote_tmp_dir }}" - name: Create deb files shell: "find {{ remote_tmp_dir }}/package_specs/{{ item }} -type f -exec equivs-build {} \\;" args: chdir: "{{ repodir }}/dists/{{ item }}/main/binary-all" loop: - stable - testing - name: Create repo Packages shell: dpkg-scanpackages --multiversion . /dev/null dists/{{ item }}/main/binary-all/ | gzip -9c > Packages.gz args: chdir: "{{ repodir }}/dists/{{ item }}/main/binary-all" loop: - stable - testing - name: Create repo Release copy: content: | Codename: {{ item.0 }} {% for k,v in item.1.items() %} {{ k }}: {{ v }} {% endfor %} dest: "{{ repodir }}/dists/{{ item.0 }}/Release" loop: - [stable, {}] - [testing, {NotAutomatic: "yes", ButAutomaticUpgrades: "yes"}] - name: Install the repo apt_repository: repo: deb [trusted=yes arch=all] file:{{ repodir }} {{ item }} main update_cache: false # interferes with task 'Test update_cache 1' loop: - stable - testing # Need to uncomment the deb-src for the universe component for build-dep state - name: Ensure deb-src for the universe component lineinfile: path: /etc/apt/sources.list backrefs: True regexp: ^#\s*deb-src http://archive\.ubuntu\.com/ubuntu/ (\w*){{ item }} universe$ line: deb-src http://archive.ubuntu.com/ubuntu \1{{ item }} universe state: present with_items: - '' - -updates when: ansible_distribution in ['Ubuntu', 'Debian']