Fix detection of mkisofs

The shell module does not return an error on command not found, use
the command module.

Change-Id: I030806640ae0843dea1d4eb294f7e909990d40f4
This commit is contained in:
Dmitry Tantsur 2020-05-28 13:31:41 +02:00
parent d804de86b1
commit 2be8ee6d85

View File

@ -82,17 +82,12 @@
when: write_interfaces_file | bool == true
- name: "Check if mkisofs is available"
shell: mkisofs --help &> /dev/null
command: mkisofs --help
ignore_errors: yes
register: test_mkisofs
- name: "If mkisofs is not available, fallback to genisoimage"
set_fact:
iso_gen_utility: "genisoimage"
when: ('genisoimage' in test_mkisofs.stderr) or test_mkisofs.rc != 0
- name: "Check if genisoimage is available"
shell: genisoimage --help &> /dev/null
command: genisoimage --help
ignore_errors: yes
register: test_genisoimage
@ -100,6 +95,11 @@
fail: msg="Neither mkisofs or genisoimage is available. Cannot make config drive files."
when: test_genisoimage.rc != 0 and test_mkisofs.rc != 0
- name: "If mkisofs is not available, fallback to genisoimage"
set_fact:
iso_gen_utility: "genisoimage"
when: test_mkisofs.rc != 0
- name: "Make config drive files"
become: yes
command: "{{iso_gen_utility}} -R -V config-2 -o {{http_boot_folder}}/configdrive-{{ uuid }}.iso {{ variable_configdrive_location.stdout }}/{{ uuid }}"