blob: 471fb2a2c1a3e8576b579064125259f0bad04322 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
- 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']
|