Closed sxpert closed 8 years ago
Hmm, never seen that error yet, I'll test it out.
@sxpert Well... I've set up a role with dependency on debops.ifupdown
with variables you specified and it works, no errors. You probably need to be more specific, or you could try removing part of the template used to generate the configuration until you find which variable doesn't want to cooperate.
ansible_interfaces is undefined in :
{% if not ifupdown_tpl_generate_interface and not ifupdown_tpl_generate_interface_extended and not ifupdown_tpl_generate_interface_failed and (item.type is undefined or (item.type is defined and item.type == ifupdown_tpl_config_type) and (not ifupdown_tpl_virtual_interface and item.iface in ansible_interfaces) or (item.force is defined and item.force)) %}
{% set ifupdown_tpl_generate_interface = True %}
{% else %}
{% if not ifupdown_tpl_failure_reason %}
{% set ifupdown_tpl_failure_reason = ifupdown_tpl_config_alias | capitalize + ' ' + item.iface + ' not found' %}
{% endif %}
{% endif %}
@sxpert That's... Do you gather facts when playbook starts?
hah !!
adding a setup somewhere at the end of my ubuntu_vm role did it ;-)
mebbe there should be something more explicit in the manual, it didn't strike me ;-)
Well, IIRC Ansible gathers facts automatically by default, you would need to explicitly disable this in the playbook or in ansible.cfg
.
this starts as a role running on the hypervisor as there's no vm working yet
https://github.com/sxpert/jmmc/blob/master/roles/ubuntu-vm/tasks/main.yml
then, we want to change the network configuration of the new vm here :
https://github.com/sxpert/jmmc/blob/master/roles/jmmc-controller/meta/main.yml
@sxpert Ah, I see... You basically are doing the instantiation and set up in one go. That explains that.
anyways, thanks for helping ;-)
I am building this automatic vm installer with pxe booting and stuff, with dhcp. at some point in the script I want to reconfigure the network so as to set a static ip on eth1 (this part is not there yet, am trying to get the dhcp bit on eth0 working first. for some reason it does part of the job, but fails at the configuration file generation task... I have the following as a dependency of a role :
here's the result :
the expected behavior should be no visible change from the default configuration