Use async for RPM verification

This patch runs the RPM verification asynchronously to speed up the
playbook run.

Change-Id: I7e114031cf81f89b6134614ebcff62edc5fafc65
This commit is contained in:
Major Hayden
2017-02-07 14:33:10 -06:00
parent a2b3fe1598
commit 4a23bc88ff
2 changed files with 25 additions and 11 deletions

View File

@@ -31,6 +31,24 @@
tags:
- always
# Multiple tasks will need the output of RPM verification, so let's do the
# lookup one time and then grep over the output in subsequent tasks.
- name: Verify all installed RPM packages
shell: "rpm -Va > {{ temp_dir }}/rpmverify.txt"
args:
warn: no
failed_when: False
changed_when: False
register: rpmverify_task
async: 300
poll: 0
when:
- not check_mode | bool
- ansible_os_family | lower == 'redhat'
tags:
- always
- skip_ansible_lint
# Package installations and removals must come first so that configuration
# changes can be made later.
- include: packages.yml

View File

@@ -13,20 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Multiple tasks will need the output of RPM verification, so let's do the
# lookup one time and then grep over the output in subsequent tasks.
- name: Verify all installed RPM packages
shell: "rpm -Va > {{ temp_dir }}/rpmverify.txt"
args:
warn: no
- name: Ensure RPM verification task has finished
async_status:
jid: "{{ rpmverify_task.ansible_job_id }}"
failed_when: False
changed_when: False
register: job_result
until: job_result.finished
retries: 30
when:
- not check_mode | bool
- ansible_os_family | lower == 'redhat'
tags:
- always
- skip_ansible_lint
- not rpmverify_task | skipped
- name: RHEL-07-010020 - Get files with invalid checksums (rpm)
shell: "grep '^..5' {{ temp_dir }}/rpmverify.txt | awk '{ print $NF }'"