Skip to content

Instantly share code, notes, and snippets.

@steelcowboy
Created July 12, 2020 05:22
Show Gist options
  • Save steelcowboy/b5dd6f3fee3064d1ecf4cf1c535f66e8 to your computer and use it in GitHub Desktop.
Save steelcowboy/b5dd6f3fee3064d1ecf4cf1c535f66e8 to your computer and use it in GitHub Desktop.
Ansible issue

Goal

Define a nested dictionary in the inventory vars. See this repo for full implementation

vars:
  packages:
    install: []
    remove: []
TASK [packages : debug] ****************************************************************************************************************************************************************************************
ok: [localhost] => {
    "packages": {
        "install": [
            "zsh",
            "git",
            "fasd"
        ]
    }
}

TASK [packages : removing the following packages] **************************************************************************************************************************************************************
ok: [localhost] => {
    "packages.remove": "VARIABLE IS NOT DEFINED!"
}

Question

Why is packages['remove'] not defined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment