| |
@@ -26,30 +26,26 @@
|
| |
- '!all'
|
| |
delegate_facts: True
|
| |
|
| |
+ - name: Check if required packages are installed on the system
|
| |
+ command: rpm -q {{ item }}
|
| |
+ ignore_errors: True
|
| |
+ register: rpm_result
|
| |
+ with_items:
|
| |
+ - rpm-build
|
| |
+
|
| |
+ - name: Add packages needed to install
|
| |
+ set_fact:
|
| |
+ missing_pkgs: "{{ missing_pkgs + [ item.item ]}}"
|
| |
+ when: item.failed == true
|
| |
+ with_items: "{{ rpm_result.results }}"
|
| |
+
|
| |
- name: Install basic package dependencies
|
| |
package: name={{ item }} state=present
|
| |
register: result
|
| |
- with_items:
|
| |
- - rpm-build
|
| |
+ with_items: "{{ missing_pkgs }}"
|
| |
retries: 5
|
| |
delay: 10
|
| |
until: result is succeeded
|
| |
- when: ansible_user_id == 'root'
|
| |
-
|
| |
- - block:
|
| |
- - name: Check if required packages are installed on the system
|
| |
- command: rpm -q {{ item }}
|
| |
- ignore_errors: True
|
| |
- register: rpm_result
|
| |
- with_items:
|
| |
- - rpm-build
|
| |
-
|
| |
- - fail:
|
| |
- msg: "Some of the required packages were not found on the localhost: {{ rpm_result.results[0].stdout }}"
|
| |
- # `rpm_result` will become array, due to `with_items`
|
| |
- when: rpm_result.results[0].failed == true
|
| |
-
|
| |
- when: ansible_user_id != 'root'
|
| |
|
| |
- name: Get the specfile package name
|
| |
shell: rpm -q --specfile --queryformat="%{NAME}\n" {{pkgdir}}/*.spec | head -n1
|
| |
only try to install package if it is not installed