Skip to content

Commit 35611e1

Browse files
committed
Try using mirror:// URI
1 parent a2da0fc commit 35611e1

File tree

8 files changed

+39
-22
lines changed

8 files changed

+39
-22
lines changed

roles/common/tasks/main.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
dest: "{{ wrapper_desktop_file_path }}/jmucs_config.desktop"
5858
mode: "0755"
5959

60+
- name: Set Ubuntu mirrors
61+
template:
62+
src: ubuntu-mirrors.j2
63+
dest: "{{ mirror_file_path.ubuntu }}"
64+
mode: "0644"
65+
owner: root
66+
group: root
67+
6068
- include_tasks: ubuntu_only.yml
6169
when: "ansible_distribution == 'Ubuntu'"
6270
- include_tasks: mint_only.yml
@@ -66,5 +74,4 @@
6674
update_cache: yes
6775
register: apt_update
6876
retries: 100
69-
failed_when: apt_update.failed and 'Unable to connect to' not in apt_update.stderr
7077
until: apt_update is success or ('Failed to lock apt for exclusive operation' not in apt_update.msg and '/var/lib/dpkg/lock' not in apt_update.msg)

roles/common/tasks/mint_only.yml

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
group: root
1818

1919
- name: Set Linux Mint mirrors
20+
template:
21+
src: mint-mirrors.j2
22+
dest: "{{ mirror_file_path.mint }}"
23+
owner: root
24+
group: root
25+
mode: "0644"
26+
when: "ansible_architecture == 'x86_64'"
27+
- name: Set Linux Mint sources
2028
template:
2129
src: mint.j2
2230
dest: /etc/apt/sources.list.d/official-package-repositories.list

roles/common/tasks/ubuntu_only.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# tasks file for Ubuntu
33

4-
- name: Set Ubuntu mirrors
4+
- name: Set Ubuntu sources
55
template:
66
src: ubuntu.j2
77
dest: /etc/apt/sources.list
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{% for mirror in mint_mirrors %}
2+
{{ mirror }}
3+
{% endfor %}

roles/common/templates/mint.j2

+7-13
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,14 @@
44
# Place modifications in another file in /etc/apt/sources.list.d/ with a .list
55
# file extension.
66

7-
{% for mirror in ubuntu_mirrors %}
8-
# Upstream Ubuntu sources for {{ mirror }}
9-
deb {{ mirror }} {{ ubuntu_release }} main restricted universe multiverse
10-
deb {{ mirror }} {{ ubuntu_release }}-updates main restricted universe multiverse
11-
deb {{ mirror }} {{ ubuntu_release }}-backports main restricted universe multiverse
12-
deb {{ mirror }} {{ ubuntu_release }}-security main restricted universe multiverse
7+
# Ubuntu sources
8+
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }} main restricted universe multiverse
9+
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-updates main restricted universe multiverse
10+
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-backports main restricted universe multiverse
11+
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-security main restricted universe multiverse
1312

14-
{% endfor %}
15-
16-
{% for mirror in mint_mirrors %}
17-
# Mint sources for {{ mirror }}
18-
deb {{ mirror }} {{ ansible_distribution_release }} main upstream import backport
19-
20-
{% endfor %}
13+
# Mint sources
14+
deb mirror+file://{{ mirror_file_path.mint }} {{ ansible_distribution_release }} main upstream import backport
2115

2216
# Parter repository (necessary for optional media codecs) -- not mirrored
2317
deb http://archive.canonical.com/ubuntu {{ ubuntu_release }} partner
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{% for mirror in ubuntu_mirrors %}
2+
{{ mirror }}
3+
{% endfor %}

roles/common/templates/ubuntu.j2

+5-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
# Place modifications in another file in /etc/apt/sources.list.d/ with a .list
55
# file extension.
66

7-
{% for mirror in ubuntu_mirrors %}
8-
deb {{ mirror }} {{ ubuntu_release }} main restricted universe multiverse
9-
deb {{ mirror }} {{ ubuntu_release }}-updates main restricted universe multiverse
10-
deb {{ mirror }} {{ ubuntu_release }}-backports main restricted universe multiverse
11-
deb {{ mirror }} {{ ubuntu_release }}-security main restricted universe multiverse
12-
13-
{% endfor %}
7+
# Ubuntu sources
8+
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }} main restricted universe multiverse
9+
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-updates main restricted universe multiverse
10+
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-backports main restricted universe multiverse
11+
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-security main restricted universe multiverse
1412

1513
# Parter repository (necessary for optional media codecs) -- not mirrored
1614
deb http://archive.canonical.com/ubuntu {{ ubuntu_release }} partner

roles/common/vars/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ mint_mirrors:
88
- "https://mirror.cs.jmu.edu/pub/linuxmint/packages"
99
- "http://packages.linuxmint.com"
1010

11+
mirror_file_path:
12+
mint: /etc/apt/mint-mirrors.txt
13+
ubuntu: /etc/apt/ubuntu-mirrors.txt
14+
1115
global_base_path: "/opt"
1216
global_profile_path: "{{ global_base_path }}/csvmprofile"
1317

0 commit comments

Comments
 (0)