From: Zack Cerza Date: Thu, 14 May 2015 19:08:11 +0000 (-0600) Subject: Move ISO dir/mountpoint creation to cobbler role X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F29%2Fhead;p=ceph-cm-ansible.git Move ISO dir/mountpoint creation to cobbler role Signed-off-by: Zack Cerza --- diff --git a/roles/cobbler/defaults/main.yml b/roles/cobbler/defaults/main.yml index b095e402..7710df9f 100644 --- a/roles/cobbler/defaults/main.yml +++ b/roles/cobbler/defaults/main.yml @@ -1,4 +1,9 @@ --- +# Where to download ISOs +iso_dir: /var/lib/cobbler/isos +# Mount point to use for ISOs during import +iso_mount: /mnt/iso + kickstarts: - cephlab_trusty.preseed - cephlab_rhel.ks diff --git a/roles/cobbler/tasks/distro_prep.yml b/roles/cobbler/tasks/distro_prep.yml index 8c6ba7b8..27e7d252 100644 --- a/roles/cobbler/tasks/distro_prep.yml +++ b/roles/cobbler/tasks/distro_prep.yml @@ -1,3 +1,13 @@ --- - name: Update distro signatures command: cobbler signature update + +- name: Create ISO directory + file: + path: "{{ iso_dir }}" + state: directory + +- name: Create ISO mountpoint + file: + path: "{{ iso_mount }}" + state: directory diff --git a/roles/cobbler_profile/defaults/main.yml b/roles/cobbler_profile/defaults/main.yml index e8022cf8..f37e62d7 100644 --- a/roles/cobbler_profile/defaults/main.yml +++ b/roles/cobbler_profile/defaults/main.yml @@ -1,9 +1,4 @@ --- -# Where to download ISOs -iso_dir: /var/lib/cobbler/isos -# Mount point to use for ISOs during import -iso_mount: /mnt/iso - distros: # Distros with empty iso values will be skipped. These dicts will be # updated with same-named items in an 'extra_distros' var, which can be diff --git a/roles/cobbler_profile/tasks/download_iso.yml b/roles/cobbler_profile/tasks/download_iso.yml index e2f4b271..c6b65fc6 100644 --- a/roles/cobbler_profile/tasks/download_iso.yml +++ b/roles/cobbler_profile/tasks/download_iso.yml @@ -1,14 +1,4 @@ --- -- name: Create ISO directory - file: - path: "{{ iso_dir }}" - state: directory - -- name: Create ISO mountpoint - file: - path: "{{ iso_mount }}" - state: directory - - name: Set ISO name set_fact: iso_name: "{{ distro.iso.split('/')[-1] }}" @@ -17,6 +7,10 @@ set_fact: iso_path: "{{ iso_dir }}/{{ iso_name }}" +- name: Check to see if the ISO exists + stat: path={{ iso_path }} get_checksum=no get_md5=no + register: iso_stat + - name: Download ISO get_url: url={{ distro.iso }} diff --git a/roles/cobbler_profile/tasks/import_distro.yml b/roles/cobbler_profile/tasks/import_distro.yml index 7d33c4ad..6ab3cbd0 100644 --- a/roles/cobbler_profile/tasks/import_distro.yml +++ b/roles/cobbler_profile/tasks/import_distro.yml @@ -33,7 +33,8 @@ - name: Mount ISO command: mount -o loop {{ iso_path }} {{ iso_mount }} - when: download|changed + when: download|changed or (iso_stat.stat.exists and + profile is defined and profile.stdout == '') register: mount - name: Set arch