toml – Uses a specific TOML file as an inventory source

New in version 2.8.

Synopsis

  • TOML based inventory format
  • File MUST have a valid ‘.toml’ file extension

Notes

Note

  • Requires the ‘toml’ python library

Examples

example1: |
    [all.vars]
    has_java = false

    [web]
    children = [
        "apache",
        "nginx"
    ]
    vars = { http_port = 8080, myvar = 23 }

    [web.hosts]
    host1 = {}
    host2 = { ansible_port = 222 }

    [apache.hosts]
    tomcat1 = {}
    tomcat2 = { myvar = 34 }
    tomcat3 = { mysecret = "03#pa33w0rd" }

    [nginx.hosts]
    jenkins1 = {}

    [nginx.vars]
    has_java = true

example2: |
    [all.vars]
    has_java = false

    [web]
    children = [
        "apache",
        "nginx"
    ]

    [web.vars]
    http_port = 8080
    myvar = 23

    [web.hosts.host1]
    [web.hosts.host2]
    ansible_port = 222

    [apache.hosts.tomcat1]

    [apache.hosts.tomcat2]
    myvar = 34

    [apache.hosts.tomcat3]
    mysecret = "03#pa33w0rd"

    [nginx.hosts.jenkins1]

    [nginx.vars]
    has_java = true

example3: |
    [ungrouped.hosts]
    host1 = {}
    host2 = { ansible_host = "127.0.0.1", ansible_port = 44 }
    host3 = { ansible_host = "127.0.0.1", ansible_port = 45 }

    [g1.hosts]
    host4 = {}

    [g2.hosts]
    host4 = {}

Status

Red Hat Support

More information about Red Hat’s support of this inventory is available from this Red Hat Knowledge Base article.

Authors

  • UNKNOWN

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.8/plugins/inventory/toml.html