1 # Copyright (c) 2018 Intel Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # Arguments needed: arch_arm64, arch_amd64, ubuntu_archive
17 - name: Set the repositories architecture name
19 arch: "{{ arch_arm64 if ansible_architecture == 'aarch64' else arch_amd64 }}"
20 extra_arch: "{{ arch_amd64 if ansible_architecture == 'aarch64' else arch_arm64 }}"
22 - name: Define the repositories names
24 repo: "{{ ubuntu_archive[arch] }}"
25 extra_repo: "{{ ubuntu_archive[extra_arch] }}"
27 - name: Add architecture to the default repository list
29 path: "{{ sources_list_file }}"
30 regexp: '(^deb\s+)([^\[].*)$'
31 replace: 'deb [arch={{ arch }}] \2'
33 - name: Remove support for source repositories
35 path: "{{ sources_list_file }}"
39 - name: Add extra architecture
40 command: "dpkg --add-architecture {{ extra_arch }}"
42 - name: Define the default release version
44 dest: "{{ default_distro_file }}"
45 content: 'APT::Default-Release "{{ ansible_distribution_release }}";'
47 - name: Remove extra repository file
49 path: "{{ repo_file }}"
53 - name: Add extra repository file
55 path: "{{ repo_file }}"
58 - name: Add the repository for qemu_static_user/xenial
60 path: "{{ repo_file }}"
63 deb [arch={{ arch }}] {{ repo }} xenial-updates universe
64 when: ansible_distribution_release != "xenial"
66 - name: Add extra architecture repositories if installing in container
68 path: "{{ repo_file }}"
71 deb [arch={{ extra_arch }}] {{ extra_repo }} {{ ansible_distribution_release }} main universe multiverse restricted
72 deb [arch={{ extra_arch }}] {{ extra_repo }} {{ ansible_distribution_release }}-updates main universe multiverse restricted
73 deb [arch={{ extra_arch }}] {{ extra_repo }} {{ ansible_distribution_release }}-security main universe multiverse restricted
74 deb [arch={{ extra_arch }}] {{ extra_repo }} {{ ansible_distribution_release }}-proposed main universe multiverse restricted
75 when: installation_mode == "container"
77 - name: Remove the marker
79 dest: "{{ repo_file }}"