How to make Ansible run batch of tasks on Cluster Node's - node by node
You missed a dash in front of block
.
Removing all attributes your tasks look like this:
tasks:
- name: get Cluster state
- name: trigger Zero Downtime upgrade API
block:
# ^-- dash missing
- name: "Upgrade {{ ansible_hostname }} atl node."
- name: create dir for backup configuration
- name: "stop atl service on {{ ansible_hostname }} atl node"
- name: Install New atl Version.
- name: Configure systemd service.
# ^-- indented incorrectly
- name: Reload Enable and Start atl.service
- name: health checks - trigger GET node state.
As you see, block
is currently an attribute for the previous task, it should be at the level of tasks
instead.
Additionally, your task Configure systemd service.
is not indented correctly, it should be at the same level as the other tasks.
tasks:
- name: get Cluster state
- name: trigger Zero Downtime upgrade API
- block:
# ^-- added missing dash
- name: "Upgrade {{ ansible_hostname }} atl node."
- name: create dir for backup configuration
- name: "stop atl service on {{ ansible_hostname }} atl node"
- name: Install New atl Version.
- name: Configure systemd service.
# ^-- indented correctly
- name: Reload Enable and Start atl.service
- name: health checks - trigger GET node state.
YAML is extremely picky about indentation.