2018-03-22 19:14:40 +01:00
|
|
|
- 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 dir
|
|
|
|
file:
|
|
|
|
path: "{{ repodir }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
|
|
|
|
2019-01-25 04:25:06 +01:00
|
|
|
- name: Copy package specs to remote
|
|
|
|
copy:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ remote_tmp_dir }}/{{ item | basename }}"
|
|
|
|
with_fileglob:
|
|
|
|
- "files/package_specs/*"
|
|
|
|
|
2018-03-22 19:14:40 +01:00
|
|
|
- name: Create deb files
|
2019-01-25 04:25:06 +01:00
|
|
|
shell: "equivs-build {{ remote_tmp_dir }}/{{ item | basename }}"
|
2018-03-22 19:14:40 +01:00
|
|
|
args:
|
|
|
|
chdir: "{{ repodir }}"
|
|
|
|
with_fileglob:
|
|
|
|
- "files/package_specs/*"
|
|
|
|
|
|
|
|
- name: Create repo
|
|
|
|
shell: dpkg-scanpackages --multiversion . /dev/null | gzip -9c > Packages.gz
|
|
|
|
args:
|
|
|
|
chdir: "{{ repodir }}"
|
|
|
|
|
2019-01-15 00:02:32 +01:00
|
|
|
# Can't use apt_repository as it doesn't expose a trusted=yes option
|
2018-03-22 19:14:40 +01:00
|
|
|
- name: Install the repo
|
2019-01-15 00:02:32 +01:00
|
|
|
copy:
|
|
|
|
content: deb [trusted=yes] file:{{ repodir }} ./
|
|
|
|
dest: /etc/apt/sources.list.d/file_tmp_repo.list
|
|
|
|
|
|
|
|
# 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
|
2018-03-22 19:14:40 +01:00
|
|
|
|
|
|
|
when: ansible_distribution in ['Ubuntu', 'Debian']
|