- name: create docker swarm for manager
when: inventory_hostname in groups['manager_hosts']
command:
cmd: docker swarm init --advertise-addr $(hostname -i)
tags: [install, docker, swarm]
ASK [create docker swarm for manager] *******************************************************************************************************************************************************************************************************
skipping: [cluster2] => {"changed": false, "skip_reason": "Conditional result was False"}
skipping: [cluster3] => {"changed": false, "skip_reason": "Conditional result was False"}
skipping: [cluster4] => {"changed": false, "skip_reason": "Conditional result was False"}
fatal: [cluster1]: FAILED! => {"changed": true, "cmd": ["docker", "swarm", "init", "--advertise-addr", "$(hostname", "-i)"], "delta": "0:00:00.222955", "end": "2022-10-08 14:26:25.128107", "msg": "non-zero return code", "rc": 125, "start": "2022-10-08 14:26:24.905152", "stderr": "unknown shorthand flag: 'i' in -i)\nSee 'docker swarm init --help'.", "stderr_lines": ["unknown shorthand flag: 'i' in -i)", "See 'docker swarm init --help'."], "stdout": "", "stdout_lines": []}
- name: copy manager-token to variable
when: inventory_hostname in groups['manager_hosts']
command:
cmd: docker swarm join-token -q worker
register: token
tags: [install, docker, swarm]
TASK [copy manager-token to variable] ********************************************************************************************************************************************************************************************************
skipping: [cluster2] => {"changed": false, "skip_reason": "Conditional result was False"}
skipping: [cluster3] => {"changed": false, "skip_reason": "Conditional result was False"}
skipping: [cluster4] => {"changed": false, "skip_reason": "Conditional result was False"}
TASK [debug] *********************************************************************************************************************************************************************************************************************************
fatal: [cluster2]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout_lines'\n\nThe error appears to be in '/home/pi/PiCluster/ansible/playbooks/install_cluster.yaml': line 150, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - debug:\n ^ here\n"}
fatal: [cluster3]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout_lines'\n\nThe error appears to be in '/home/pi/PiCluster/ansible/playbooks/install_cluster.yaml': line 150, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - debug:\n ^ here\n"}
fatal: [cluster4]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout_lines'\n\nThe error appears to be in '/home/pi/PiCluster/ansible/playbooks/install_cluster.yaml': line 150, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - debug:\n ^ here\n"}