toml – Uses a specific TOML file as an inventory source — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# toml – Uses a specific TOML file as an inventory source

New in version 2.8.

- Synopsis
- Notes
- Examples
- Status

## 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

- This inventory is not guaranteed to have a backwards compatible interface. [preview]
- This inventory is maintained by the Ansible Core Team. [core]

### 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.