hosts: swarm_manager
become: true
tasks:
- name: Install requirements packages
dnf:
name:
- python3-docker
state: present
- name: Init a new swarm with default parameters
docker_swarm:
state: present
register: result
- name: Return worker token
debug:
var: result.swarm_facts.JoinTokens.Worker
- hosts: swarm_worker
become: true
tasks:
- name: Return worker token
debug:
msg: result.swarm_facts.JoinTokens.Worker
Обращайся к ней как к hostvars твоего мастера
https://github.com/erzh1906/kubernetes-playbook/blob/master/roles/k8s_master/tasks/certificates.yml#L8 типа такого
Обсуждают сегодня