Merge "Add active wait function"
[yardstick.git] / ansible / roles / add_repos_jumphost / tasks / Debian.yml
1 # Copyright (c) 2018 Intel Corporation.
2 #
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
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14 ---
15 # Arguments needed: arch_arm64, arch_amd64, ubuntu_archive
16
17 - name: Set the repositories architecture name
18   set_fact:
19     arch: "{{ arch_arm64 if ansible_architecture == 'aarch64' else arch_amd64 }}"
20     extra_arch: "{{ arch_amd64 if ansible_architecture == 'aarch64' else arch_arm64 }}"
21
22 - name: Define the repositories names
23   set_fact:
24     repo: "{{ ubuntu_archive[arch] }}"
25     extra_repo: "{{ ubuntu_archive[extra_arch] }}"
26
27 - name: Add architecture to the default repository list
28   replace:
29     path: "{{ sources_list_file }}"
30     regexp: '(^deb\s+)([^\[].*)$'
31     replace: 'deb [arch={{ arch }}] \2'
32
33 - name: Remove support for source repositories
34   replace:
35     path: "{{ sources_list_file }}"
36     regexp: "^deb-src "
37     replace: "# deb-src "
38
39 - name: Add extra architecture
40   apt:
41     dpkg_options: "add-architecture {{ extra_arch }}"
42
43 - name: Define the default release version
44   copy:
45     dest: "{{ default_distro_file }}"
46     content: 'APT::Default-Release "{{ ansible_distribution_release }}";'
47
48 - name: Remove extra repository file
49   file:
50     path: "{{ repo_file }}"
51     state: absent
52   ignore_errors: yes
53
54 - name: Add extra repository file
55   file:
56     path: "{{ repo_file }}"
57     state: touch
58
59 - name: Add the repository for qemu_static_user/xenial
60   blockinfile:
61     path: "{{ repo_file }}"
62     marker: "MARKER"
63     content: |
64       deb [arch={{ arch }}] {{ repo }} xenial-updates universe
65   when: ansible_distribution_release != "xenial"
66
67 - name: Add extra architecture repositories if installing in container
68   blockinfile:
69     path: "{{ repo_file }}"
70     marker: "MARKER"
71     content: |
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"
77
78 - name: Remove the marker
79   lineinfile:
80     dest: "{{ repo_file }}"
81     state: absent
82     regexp: "MARKER"