]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
cobbler_profile: move kickstart updating tasks into their own yml file.
authorAndrew Schoen <aschoen@redhat.com>
Tue, 19 May 2015 20:50:00 +0000 (15:50 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 20 May 2015 21:18:21 +0000 (16:18 -0500)
This also introduce a var, profile_found, which we can reuse for
updating other parts of a profile like kernel options.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
roles/cobbler_profile/tasks/import_distro.yml
roles/cobbler_profile/tasks/update_kickstart.yml [new file with mode: 0644]

index 7300a4a1ce0b0eaf5c21b8dbfdfc0c980ff79720..f683b399b7ca6a1a4d72258405e2e9147c5e9ede 100644 (file)
     state: unmounted
   when: mount is defined and mount|changed
 
-- name: Set kickstart path
+# If either the profile already existed or we successfully imported the
+# distro, we might want to update other options in the profile. i.e. kickstarts
+- name: Set profile_found
   set_fact:
-    kickstart_path: /var/lib/cobbler/kickstarts/{{ distro.kickstart }}
-  # If either the profile already existed or we successfully imported the
-  # distro, let's see if we need to change the kickstart.
-  when: distro.kickstart is defined and distro.kickstart != '' and
+    profile_found:
         ((profile is defined and profile.stdout == distro_name) or
          (import is defined and import.rc == 0))
 
-- name: Check to see if the kickstart needs updating
-  shell: cobbler profile dumpvars --name={{ distro_name }} | grep '^kickstart :' | awk '{ print $3 }'
-  when: kickstart_path is defined
-  changed_when: false
-  register: kickstart
-
-- name: "Set the profile's kickstart"
-  command: cobbler profile edit --name={{ distro_name }} --kickstart={{ kickstart_path }}
-  when: kickstart is defined and kickstart.stdout != kickstart_path
+- include: update_kickstart.yml
+  when: distro.kickstart is defined and distro.kickstart != '' and
+        profile_found
diff --git a/roles/cobbler_profile/tasks/update_kickstart.yml b/roles/cobbler_profile/tasks/update_kickstart.yml
new file mode 100644 (file)
index 0000000..9ad469a
--- /dev/null
@@ -0,0 +1,15 @@
+---
+- name: Set kickstart path
+  set_fact:
+    kickstart_path: /var/lib/cobbler/kickstarts/{{ distro.kickstart }}
+
+- name: Check to see if the kickstart needs updating
+  shell: cobbler profile dumpvars --name={{ distro_name }} | grep '^kickstart :' | awk '{ print $3 }'
+  when: kickstart_path is defined
+  changed_when: false
+  register: kickstart
+
+- name: "Set the profile's kickstart"
+  command: cobbler profile edit --name={{ distro_name }} --kickstart={{ kickstart_path }}
+  when: kickstart is defined and
+        kickstart.stdout != kickstart_path