Hello,

I've got the following ansible code:

- 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 cobbler

When the file /var/www/cobbler/ks_mirror/{{ item.name }}-{{ item.arch 
}}/images/pxeboot/initrd.img doesn't exist, the shell command must be 
executed. But when I run this code, I get the following output:

TASK: [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)

It skippes the "add distro to cobbler" while it should run. Can someone 
help me to fix this issue.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e2c855f0-1a3b-487f-ad43-ef4e6a1fb945%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to