- include: download_iso.yml
when: distro.iso != ''
+# we do this so that if the playbook fails
+# after mounting and we need to run it again
+# then we'll remount and complete the rest
+# of the tasks like it's the first run
+- name: Clear the mount point.
+ mount:
+ name: "{{ iso_mount }}"
+ src: "{{ iso_path }}"
+ fstype: "iso9660"
+ state: unmounted
+
- name: Mount ISO
- command: mount -o loop {{ iso_path }} {{ iso_mount }}
+ mount:
+ name: "{{ iso_mount }}"
+ src: "{{ iso_path }}"
+ opts: "loop"
+ fstype: "iso9660"
+ state: mounted
when: download|changed or (iso_stat.stat.exists and
profile is defined and profile.stdout == '')
register: mount
- name: Set arch
set_fact:
arch: "{{ distro.arch|default('x86_64') }}"
- when: mount is defined and mount.rc == 0
+ when: mount is defined and mount|changed
- name: Import the distro (also creates the profile)
command: cobbler import --path={{ iso_mount }} --name={{ distro_name }} --arch={{ arch }}
register: import
- when: mount is defined and mount.rc == 0
+ when: mount is defined and mount|changed
- name: Unmount ISO
- command: umount {{ iso_mount }}
- when: mount is defined and mount.rc == 0
+ mount:
+ name: "{{ iso_mount }}"
+ src: "{{ iso_path }}"
+ fstype: "iso9660"
+ state: unmounted
+ when: mount is defined and mount|changed
- name: Set kickstart path
set_fact: