Ansible Playbooks für Cisco Geräte

Ich habe jetzt mal angefangen kleine Snippets / Playbooks in einem Github Repo zu sammeln.

lanbugs/cisco_ansible_playbooks: Ansible playbooks collection for Cisco network devices (github.com)

Freue mich auf Feedback und viel Spaß damit 🙂

Beispiel „Interface Description setzen bei Interfaces wo ein Access Point angeschlossen ist“:

---

# Apply description to interfaces where in CDP neighbor an AP is detected

- hosts: all
  gather_facts: True
  vars:
    cli:
      host: "{{ ansible_host }}"
      username: "{{ ansible_user }}"
      password: "{{ ansible_ssh_pass }}"
    ansible_ssh_common_args: -o StrictHostKeyChecking=no


  tasks:
    - name: Set description to interface
      ios_config:
        lines:
          - description Access Point
        parents: 'interface {{ item.key }}'
        save_when: modified
      with_dict: "{{ ansible_facts.net_neighbors }}"
      when: '"AIR-" in item.value[0].platform'

3 Kommentare zu „Ansible Playbooks für Cisco Geräte“

  1. Hi,

    mit welcher IOS-Version // Ansible Version arbeitest du?
    Ich habe mit der Version 15.2.2E7 und 15.2.7E3 das Problem, dass das ansible_facts.net_neighbors keine Daten zurückliefert. Mit cisco.ios.facts habe ich das gleiche Problem.

    Grüße

    Antworten

Schreibe einen Kommentar

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre, wie deine Kommentardaten verarbeitet werden.