Hello I have been trying to setup a Docker Swarm with Salt but I am sort of stuck...

I am getting the following error on applying:

Data failed to compile: ---------- Rendering SLS 'base:docker.manager.first' failed: Jinja variable list object has no element 0

This is my first.sls:

{% set manager_ip = salt['mine.get']('*', 'manager_ip').items()[0][1][0] %} include: - docker.base init new swarm cluster: cmd.run: - name: 'docker swarm init --advertise-addr {{ manager_ip }}' - require: - pkg: docker-ce

This is my /srv/pillar/swarm.sls that provides the mine_functions:

mine_functions: network.ip_addrs: [ens32] manager_token: - mine_function: cmd.run - "docker swarm join-token manager -q" manager_ip: - mine_function: network.ip_addrs - ens32 worker_token: - mine_function: cmd.run - "docker swarm join-token worker -q"

When running salt '*' pillar.items:

---------- mine_functions: ---------- manager_ip: |_ ---------- mine_function: network.ip_addrs - ens32 manager_token: |_ ---------- mine_function: cmd.run - docker swarm join-token manager -q network.ip_addrs: - ens32 worker_token: |_ ---------- mine_function: cmd.run - docker swarm join-token worker -q

How do I fix this or is there any known way to setup a Docker Swarm using Salt?