You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/setup_deb_repo/tasks/main.yml

76 lines
2.0 KiB
YAML

- 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']