Hi,

I want to execute a task on my minions. The problem is, that there are 
different tasks depending on facts of the devices. How can ansible deal 
with it?

Basically I want to upgrade the operating system on Cisco network 
components. Different network models (fact: ansible_net_model) have 
different upgrade tasks.

At the moment I have

name: Upgrade IOS
  block:
    (...)
  when: (ansible_net_version != compliant_ios_version) and
    (ansible_net_model is regex("2960"))

name: Upgrade IOSXE
  block:
    (...)
  when: (ansible_net_version != compliant_ios_version) and
     (ansible_net_model is regex("9200"))


Intead of the block: when: construction I thought about a 

  - import_task: upgrade-{{  ansible_net_model }}.yaml


and files called upgrade-c2960.yaml, upgrade-x9200.yaml, ...

Is than possible?

Michael

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/be31775b-3cfc-4641-bb9b-127a95a4feae%40googlegroups.com.

Reply via email to