|
| 1 | +- name: Install lustre build prerequisites |
| 2 | + ansible.builtin.dnf: |
| 3 | + name: "{{ lustre_build_packages }}" |
| 4 | + register: _lustre_dnf_build_packages |
| 5 | + |
| 6 | +- name: Clone lustre git repo |
| 7 | + # https://git.whamcloud.com/?p=fs/lustre-release.git;a=summary |
| 8 | + ansible.builtin.git: |
| 9 | + repo: git://git.whamcloud.com/fs/lustre-release.git |
| 10 | + dest: "{{ lustre_build_dir }}" |
| 11 | + version: "{{ lustre_version }}" |
| 12 | + |
| 13 | +- name: Prepare for lustre configuration |
| 14 | + ansible.builtin.command: |
| 15 | + cmd: sh ./autogen.sh |
| 16 | + chdir: "{{ lustre_build_dir }}" |
| 17 | + |
| 18 | +- name: Configure lustre build |
| 19 | + ansible.builtin.command: |
| 20 | + cmd: "./configure {{ lustre_configure_opts | join(' ') }}" |
| 21 | + chdir: "{{ lustre_build_dir }}" |
| 22 | + |
| 23 | +- name: Build lustre |
| 24 | + ansible.builtin.command: |
| 25 | + cmd: make rpms |
| 26 | + chdir: "{{ lustre_build_dir }}" |
| 27 | + |
| 28 | +- name: Find rpms |
| 29 | + ansible.builtin.find: |
| 30 | + paths: "{{ lustre_build_dir }}" |
| 31 | + patterns: "{{ lustre_rpm_globs }}" |
| 32 | + use_regex: false |
| 33 | + register: _lustre_find_rpms |
| 34 | + |
| 35 | +- name: Check rpms found |
| 36 | + assert: |
| 37 | + that: _lustre_find_rpms.files | length |
| 38 | + fail_msg: "No lustre repos found with lustre_rpm_globs = {{ lustre_rpm_globs }}" |
| 39 | + |
| 40 | +- name: Install lustre rpms |
| 41 | + ansible.builtin.dnf: |
| 42 | + name: "{{ _lustre_find_rpms.files | map(attribute='path')}}" |
| 43 | + disable_gpg_check: yes |
| 44 | + |
| 45 | +- block: |
| 46 | + - name: Remove lustre build prerequisites |
| 47 | + # NB Only remove ones this role installed which weren't upgrades |
| 48 | + ansible.builtin.dnf: |
| 49 | + name: "{{ _new_pkgs }}" |
| 50 | + state: absent |
| 51 | + vars: |
| 52 | + _installed_pkgs: | |
| 53 | + {{ |
| 54 | + _lustre_dnf_build_packages.results | |
| 55 | + select('match', 'Installed:') | |
| 56 | + map('regex_replace', '^Installed: (.+?)-[0-9].*$', '\1') |
| 57 | + }} |
| 58 | + _removed_pkgs: | |
| 59 | + {{ |
| 60 | + _lustre_dnf_build_packages.results | |
| 61 | + select('match', 'Removed:') | |
| 62 | + map('regex_replace', '^Removed: (.+?)-[0-9].*$', '\1') |
| 63 | + }} |
| 64 | + _new_pkgs: "{{ _installed_pkgs | difference(_removed_pkgs) }}" |
| 65 | + |
| 66 | + - name: Delete lustre build dir |
| 67 | + file: |
| 68 | + path: "{{ lustre_build_dir }}" |
| 69 | + state: absent |
| 70 | + when: lustre_build_cleanup | bool |
0 commit comments