-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathptf_installation.yaml
More file actions
89 lines (78 loc) · 2.58 KB
/
ptf_installation.yaml
File metadata and controls
89 lines (78 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
- name: PTF Installation
hosts: hana
remote_user: cloudadmin
become: true
become_user: root
vars:
url_timeout: 30
url_retries_cnt: 5
url_retries_delay: 10
ptf_dir: "/tmp/ptf_dir"
tasks:
- name: Create directory for PTF installation
ansible.builtin.file:
path: "{{ ptf_dir }}"
state: directory
mode: '0755'
- name: Convert comma-separated string to list
ansible.builtin.set_fact:
az_blobs: "{{ ptf_files | split(',') }}"
when: sas_token is defined
- name: Download PTF files with SAS token
ansible.builtin.get_url:
url: "https://{{ storage }}.blob.core.windows.net/{{ container }}/{{ item }}?{{ sas_token }}"
dest: "{{ ptf_dir }}"
owner: root
group: root
mode: '0600'
timeout: "{{ url_timeout }}"
register: result
until: result is succeeded
retries: "{{ url_retries_cnt }}"
delay: "{{ url_retries_delay }}"
with_items: "{{ az_blobs }}"
when: sas_token is defined
- name: Download PTF files recursively with wget # noqa: command-instead-of-module
ansible.builtin.command: "wget --no-directories --recursive --reject 'index.html*' --user={{ ptf_user }} --password={{ ptf_password }} --no-parent {{ ptf_url }}"
args:
chdir: "{{ ptf_dir }}"
register: wget_ret
changed_when: wget_ret.rc == 0
when:
- sas_token is not defined
- ptf_user is defined
- ptf_password is defined
- ptf_url is defined
- name: List downloaded files
ansible.builtin.command: "ls -la"
args:
chdir: "{{ ptf_dir }}"
changed_when: false
register: download_list
- name: Display downloaded files
ansible.builtin.debug:
var: download_list.stdout_lines
- name: Find downloaded RPM files
ansible.builtin.find:
paths: "{{ ptf_dir }}"
patterns: "*.rpm"
register: rpm_files
- name: Display found RPM files
ansible.builtin.debug:
var: rpm_files.files
- name: Filter out src.rpm files
ansible.builtin.set_fact:
filtered_rpm_files: "{{ rpm_files.files | selectattr('path', 'search', '^(?!.*src\\.rpm$).*') | list }}"
- name: Display filtered RPM files
ansible.builtin.debug:
var: filtered_rpm_files
- name: Install PTF RPM packages
community.general.zypper:
name: "{{ item.path }}"
state: present
disable_gpg_check: true
update_cache: true
loop: "{{ filtered_rpm_files }}"
loop_control:
label: "{{ item.path }}"