Swarm mode token - Puppet module

The documentation of a swarm mode setup seems to be missing something important.
It looks like to manage swarm with puppet I need to provide a token.
But to get the token I need to go to the manager node and type docker swarm join-token -q, copy the output and paste it into puppet?

Am I missing something? Or there's some automated way to do that? What I would expect is this:

if(host_has_label("my-swarm-manager")) {
  docker::swarm {'cluster_manager':
    init           => true,
    advertise_addr => current_host_ip(),
    listen_addr    => current_host_ip(),
    swarm_name     => 'my-swarm'
  }
} else if (host_has_label("my-swarm-worker")) {
  docker::swarm {'cluster_worker':
    join           => true,
    advertise_addr => current_host_ip(),
    listen_addr    => current_host_ip(),
    manager_ip     => get_ip_by_swarm_name('my-swarm'),
    token          => get_token_by_swarm_name('my-swarm')
  }
}

Swarm mode token