Cyber Deals - Get up to 65% off on CKA, CKAD, CKS, KCNA, KCSA exams and courses!

Ansible Dictionary Sample

Sample Playbook to Handle Ansible dictionary

---
- name: Test play for dictionary
  hosts: all
  vars:
    interfaces:
      ansible-node-2:
        int1:
          intname: ens192
          intip: 10.154.158.146
          intmask: 255.255.255.128
          intgw: 10.154.158.1
  tasks:
    - name: Looping
      debug:
        msg: Hello {{ mydict }}
      #with_dict:
      #  - '{{ ens192 }}'

    - name: Looping 2
      debug:
        msg: "Int1 : {{ interfaces['ansible-node-2']['int1']['intname'] }}"
Disclaimer: Views expressed in articles are those of the respective authors and do not necessarily reflect the views of their employers or this site. While we aim for accuracy, please verify information before relying on it, and let us know if you spot an error.
Tags:
Share:

Related Posts

Terraform – Infrastructure as Code

Terraform – Infrastructure as Code

What is Terraform? Core Concepts Terraform Workflow Terraform Workspaces Terraform Modules Real-World Use Cases Ansible Lab on AWS AAP All-in-One on …

Ansible

ethical-hacking

Tools Nessus TCP Flag Definitions SYN - The beginning of connection ACK - Acknowledgment of a previous packet FIN - CLose a TCP Connection RST - …

Ansible

Ansible awx cli

Note: This notes are based on the AAP 2.5 Installation # On Red Hat Enterprise Linux 8, the Controller CLI can be installed via dnf: dnf install …

Ansible for CyberArk

Ansible for CyberArk

References Explore CyberArk Free Trial conjur Ansible and Conjur integration CyberArk Learning Resources training.cyberark.com References …

Ansible

Ansible Collections

Installing collections Using Collection on Tower References Installing collections ansible-galaxy collection install my_namespace.my_collection or

Ansible

Ansible for Windows

Checkout the Ansible Automation for Windows guides. WinRM vs OpenSSH – Pros & Cons WinRM (Default) ✔️ Pros ❌ Cons 🆕 OpenSSH ✔️ Pros ❌ Cons 💡 Use …