ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Topics
    2. Tags
    3. yaml
    Log in to post
    • All categories
    • EddieJenningsE

      Ansible facts nested variable syntax preference

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion ansible yaml ansible facts
      3
      1 Votes
      3 Posts
      1k Views
      EddieJenningsE

      @black3dynamite said in Ansible facts nested variable syntax preference:

      Looks like Bracket notation is best choice instead of dot.

      Bracket notation always works. Dot notation can cause problems because some keys collide with attributes and methods of python dictionaries. Use bracket notation if you use keys which start and end with two underscores (which are reserved for special meanings in python) or are any of the known public attributes:

      Overlooked that in the documentation. While it's less efficient to type [' and '] rather than ., I'll live with it. 🙂

    • EddieJenningsE

      YAML terminology and Ansible

      Watching Ignoring Scheduled Pinned Locked Moved Training yaml ansible
      20
      1 Votes
      20 Posts
      2k Views
      1

      @Obsolesce said in YAML terminology and Ansible:

      @Pete-S said in YAML terminology and Ansible:

      @Obsolesce said in YAML terminology and Ansible:

      @Pete-S said in YAML terminology and Ansible:

      Other than that it doesn't matter to me what anyone calls it.

      You are 100% to call it whatever you want. But a key/value pair is commonly referred to as a dictionary... or a hash table which is a dictionary data type. This isn't exclusive to Python in the least.

      "Commonly referred" depends on the programming language in question. For example in many other languages it's commonly called an array or collection and never a dictionary.

      If you look at the part you quoted, YAML calls it mappings.

      The proper computer science terminology would be associative array.
      https://en.wikipedia.org/wiki/Associative_array

      The best thing to do is to call it exactly what the language or software you are referring to calls it. If Ansible wants you to create what it has named in their documentation as a dictionary in YAML, that's what you refer to it as. Otherwise, someone who is familiar with Ansible and it's documentation won't know what the hell you are talking about if you call it your own thing.

      I can agree with that point of view - YAML in the context of Ansible.
      https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html

      So you'd call it dictionaries then. And lists.

    • DustinB3403D

      Can someone explain yaml spacing to me because Im going insane

      Watching Ignoring Scheduled Pinned Locked Moved Solved IT Discussion yaml formatting ansible
      4
      0 Votes
      4 Posts
      598 Views
      DustinB3403D

      @JaredBusch said in Can someone explain yaml spacing to me because Im going insane:

      @DustinB3403 said in Can someone explain yaml spacing to me because Im going insane:

      I'm aware there are tabs, this is due to Notepad++

      There is a setting for that in Notepad++

      I'll be searching for that tomorrow.

    • stacksofplatesS

      Ansible Syntax

      Watching Ignoring Scheduled Pinned Locked Moved IT Discussion ansible yaml configuration managment linux
      1
      3 Votes
      1 Posts
      750 Views
      No one has replied
    • 1 / 1