Add support for labels
This commit is contained in:
parent
a5cf11698f
commit
cea4a8a709
|
@ -34,3 +34,10 @@ docker_log_to_journal: True
|
|||
docker_daemon_debug: False
|
||||
docker_prometheus_metrics: True
|
||||
docker_prometheus_host: 127.0.0.1
|
||||
|
||||
# merge, replace
|
||||
docker_label_state_mode: merge
|
||||
docker_node_labels: []
|
||||
#docker_node_labels:
|
||||
# - { key: 'key_name', value: 'label_value' }
|
||||
|
||||
|
|
|
@ -41,3 +41,17 @@
|
|||
when: docker_swarm_node | bool
|
||||
delegate_to: '{{ docker_swarm_manager_main_node_hostname }}'
|
||||
tags: [ 'docker', 'docker_swarm', 'docker_swarm_worker_nodes', 'docker_swarm_worker_nodes_availability' ]
|
||||
|
||||
- name: Manage labels
|
||||
block:
|
||||
- name: Manage the swarm nodes labels
|
||||
docker_node:
|
||||
hostname: '{{ ansible_hostname }}'
|
||||
labels:
|
||||
'{{ item.key }}': '{{ item.value }}'
|
||||
labels_state: '{{ docker_label_state_mode }}'
|
||||
with_items: '{{ docker_node_labels }}'
|
||||
|
||||
when: docker_swarm_node | bool
|
||||
delegate_to: '{{ docker_swarm_manager_main_node_hostname }}'
|
||||
tags: [ 'docker', 'docker_swarm', 'docker_swarm_worker_nodes', 'docker_nodes_labels' ]
|
||||
|
|
Loading…
Reference in New Issue