Forked from marianschmotzer/gist:e3b22d1219f2d5469262
Last active
February 24, 2016 13:47
-
-
Save haad/b22af765fb5cb9e682a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add the each distro/profile pair only if the distro doesn't already exist | |
| - name: check distro exists in cobbler | |
| with_items: distros | |
| command: cobbler distro report --name={{ item.name }} | |
| register: distro_result | |
| ignore_errors: true | |
| changed_when: False | |
| when: distros is defined | |
| - debug: var=distro_result | |
| - name: add distro/profile pairs to cobbler | |
| shell: > | |
| (mkdir -p {{ item.path | quote }} | |
| && mount -t iso9660 -o loop,ro {{ item.file | quote }} {{ item.path | quote }} | |
| && cobbler import --path={{ item.path | quote }} --name={{ item.name | quote }} --arch={{ item.arch | quote }} {% if item.kickstart is defined %}--kickstart={{ item.kickstart | quote }}{% endif %} | |
| && umount {{ item.path | quote }}) | |
| with_items: distros | |
| when: distros is defined and distro_result|failed | |
| notify: | |
| - restart cobbler | |
| - wait for cobbler | |
| - sync cobbler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment