I am trying to provision a Kubernetes cluster using Ansible. My playbook includes tasks to install Docker and Kubernetes, configure the cluster, and set up networking. However, I am encountering an error related to the use of local_action
:
ERROR! 'local_action' is not a valid attribute for a Play
Here is a snippet of the playbook where the error occurs:
- name: Copy join command to local file
local_action: copy content="{{ join_command.stdout_lines[0] }}" dest="./join-command"
I have read that local_action
is deprecated and should be replaced with delegate_to: localhost
. However, I’m not sure how to modify my playbook to use delegate_to
instead.
Could someone please help me understand how to rewrite this task using delegate_to: localhost
or suggest an alternative approach?
Thank you!
brahim sallemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.