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
41 dpkg_options: "add-architecture {{ extra_arch }}"
43 - name: Define the default release version
45 dest: "{{ default_distro_file }}"
46 content: 'APT::Default-Release "{{ ansible_distribution_release }}";'
48 - name: Remove extra repository file
50 path: "{{ repo_file }}"
54 - name: Add extra repository file
56 path: "{{ repo_file }}"
59 - name: Add the repository for qemu_static_user/xenial
61 path: "{{ repo_file }}"
64 deb [arch={{ arch }}] {{ repo }} xenial-updates universe
65 when: ansible_distribution_release != "xenial"
67 - name: Add extra architecture repositories if installing in container
69 path: "{{ repo_file }}"
72 deb [arch={{ extra_arch }}] {{ extra_repo }} {{ ansible_distribution_release }} main universe multiverse restricted
73 deb [arch={{ extra_arch }}] {{ extra_repo }} {{ ansible_distribution_release }}-updates main universe multiverse restricted
74 deb [arch={{ extra_arch }}] {{ extra_repo }} {{ ansible_distribution_release }}-security main universe multiverse restricted
75 deb [arch={{ extra_arch }}] {{ extra_repo }} {{ ansible_distribution_release }}-proposed main universe multiverse restricted
76 when: installation_mode == "container"
78 - name: Remove the marker
80 dest: "{{ repo_file }}"