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
   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 }}"
     - distro
     - distro_file
   when: distro is defined and not distro_file.stat.exists
     - 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":

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.


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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
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.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupansible-project @
postedDec 20, '14 at 9:32p
activeDec 20, '14 at 9:32p

1 user in discussion

Ahaitoute: 1 post



site design / logo © 2022 Grokbase