Skip to content

Commit

Permalink
Try using mirror:// URI
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelmay committed Sep 6, 2021
1 parent 147980d commit 2b3eb58
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 22 deletions.
9 changes: 8 additions & 1 deletion roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
dest: "{{ wrapper_desktop_file_path }}/jmucs_config.desktop"
mode: "0755"

- name: Set Ubuntu mirrors
template:
src: ubuntu-mirrors.j2
dest: "{{ mirror_file_path.ubuntu }}"
mode: "0644"
owner: root
group: root

- include_tasks: ubuntu_only.yml
when: "ansible_distribution == 'Ubuntu'"
- include_tasks: mint_only.yml
Expand All @@ -66,5 +74,4 @@
update_cache: yes
register: apt_update
retries: 100
failed_when: apt_update.failed and 'Unable to connect to' not in apt_update.stderr
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)
8 changes: 8 additions & 0 deletions roles/common/tasks/mint_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
group: root

- name: Set Linux Mint mirrors
template:
src: mint-mirrors.j2
dest: "{{ mirror_file_path.mint }}"
owner: root
group: root
mode: "0644"
when: "ansible_architecture == 'x86_64'"
- name: Set Linux Mint sources
template:
src: mint.j2
dest: /etc/apt/sources.list.d/official-package-repositories.list
Expand Down
2 changes: 1 addition & 1 deletion roles/common/tasks/ubuntu_only.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# tasks file for Ubuntu

- name: Set Ubuntu mirrors
- name: Set Ubuntu sources
template:
src: ubuntu.j2
dest: /etc/apt/sources.list
Expand Down
3 changes: 3 additions & 0 deletions roles/common/templates/mint-mirrors.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for mirror in mint_mirrors %}
{{ mirror }}
{% endfor %}
20 changes: 7 additions & 13 deletions roles/common/templates/mint.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@
# Place modifications in another file in /etc/apt/sources.list.d/ with a .list
# file extension.

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

{% endfor %}

{% for mirror in mint_mirrors %}
# Mint sources for {{ mirror }}
deb {{ mirror }} {{ ansible_distribution_release }} main upstream import backport

{% endfor %}
# Mint sources
deb mirror+file://{{ mirror_file_path.mint }} {{ ansible_distribution_release }} main upstream import backport

# Parter repository (necessary for optional media codecs) -- not mirrored
deb http://archive.canonical.com/ubuntu {{ ubuntu_release }} partner
3 changes: 3 additions & 0 deletions roles/common/templates/ubuntu-mirrors.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for mirror in ubuntu_mirrors %}
{{ mirror }}
{% endfor %}
12 changes: 5 additions & 7 deletions roles/common/templates/ubuntu.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
# Place modifications in another file in /etc/apt/sources.list.d/ with a .list
# file extension.

{% for mirror in ubuntu_mirrors %}
deb {{ mirror }} {{ ubuntu_release }} main restricted universe multiverse
deb {{ mirror }} {{ ubuntu_release }}-updates main restricted universe multiverse
deb {{ mirror }} {{ ubuntu_release }}-backports main restricted universe multiverse
deb {{ mirror }} {{ ubuntu_release }}-security main restricted universe multiverse

{% endfor %}
# Ubuntu sources
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }} main restricted universe multiverse
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-updates main restricted universe multiverse
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-backports main restricted universe multiverse
deb mirror+file://{{ mirror_file_path.ubuntu }} {{ ubuntu_release }}-security main restricted universe multiverse

# Parter repository (necessary for optional media codecs) -- not mirrored
deb http://archive.canonical.com/ubuntu {{ ubuntu_release }} partner
4 changes: 4 additions & 0 deletions roles/common/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ mint_mirrors:
- "https://mirror.cs.jmu.edu/pub/linuxmint/packages"
- "http://packages.linuxmint.com"

mirror_file_path:
mint: /etc/apt/mint-mirrors.txt
ubuntu: /etc/apt/ubuntu-mirrors.txt

global_base_path: "/opt"
global_profile_path: "{{ global_base_path }}/csvmprofile"

Expand Down

0 comments on commit 2b3eb58

Please sign in to comment.