- name: check distro exists with_items: distro stat: path=/var/www/cobbler/ks_mirror/{{ item.name }}-{{ item.arch }}/images/pxeboot/initrd.img register: distro_file when: distro is defined
- name: add distro to cobbler shell: cobbler import --name="{{ item.name }}-{{ item.arch }}" --path="{{ item.url }}" --arch="{{ item.arch }}" with_items: - distro - distro_file when: distro is defined and not distro_file.stat.exists notify: - restart cobbler - wait for cobbler - sync cobblerTASK: [cobbler | check distro exists] *****************************************ok: [provisioning] => (item={'url': u'rsync://repository.rinis.net/centos_6/os/x86_64/', 'arch': 'x86_64', 'name': 'centos-6'}) => {"changed": false, "item": {"arch": "x86_64", "name": "centos-6", "url": "rsync://repository.rinis.net/centos_6/os/x86_64/"}, "stat": {"exists": false}}
TASK: [cobbler | add distro to cobbler] ***************************************skipping: [provisioning] => (item=distro)skipping: [provisioning] => (item=distro_file)