Ansible路由器模板生成器-vars_prompt

时间:2018-06-29 18:22:56

标签: network-programming ansible

我正在尝试为Cisco路由器提供一个路由器配置监控器。我有一个正确的文件夹结构和一个名为playsite的名为site.yaml的文件。它称为路由器角色,因此使用task文件夹下的main.yaml文件。只有当我在main.yaml文件中定义变量时,这部分都可以正常工作,并使用变量访问我的模板。我希望ansible提示他们,因此开始使用vars_promt。这是main.yaml文件。有任何想法吗?我收到错误消息“忽略无效属性:vars_prommpt”,却从不提示输入值

剪切粘贴添加的行会返回,但是可以,请忽略

---

- name: Generate Cisco configuration files with prompts



  vars_prompt:

    - name: "ihostname"

      prompt: "Hostname?"

    - name: "iloopback"

      prompt: "Loopback?"

    - name: "ilaninterface"

      prompt: "LAN Interface?"

    - name: "ilandataip"

      prompt: "LAN Data IP?"

    - name: "ilansubmask"

      prompt: "LAN Subnet Mask?"

    - name: "ilanvoiceip"

      prompt: "LAN Voice IP?"

    - name: "iwaninterface"

      prompt: "WAN Interface?"

    - name: "iwancarrier"

      prompt: "Circuit Carrier?"

    - name: "icircuitid"

      prompt: "Circuit ID?"

    - name: "ilecid"

      prompt: "LEC Circuit ID?"

    - name: "iceip"

      prompt: "CE IP?"

    - name: "icesubmask"

      prompt: "CE Subnet Mask?"

    - name: "ibgpas"

      prompt: "BGP AS?"  



  template: src=router.j2 dest=/root/networkauto/output/{{item.hostname}}.txt

  with_items:

  - {hostname: "{{ihostname}}", loopback: "{{iloopback}}", laninterface: "{{ilaninterface}}", landataip: "{{ilandataip}}", lansubmask: "{{ilansubmask}}", lanvoiceip: "{{ilanvoiceip}}", waninterface: "{{iwaninterface}}", wancarrier: "{{iwancarrier}}", circuitid: "{{icircuitid}}", lecid: "{{ilecid}}", ceip: "{{iceip}}", cesubmask: "{{icesubmask}}", bgpas: "{{ibgpas}}"}

0 个答案:

没有答案