E
E
ENigma3712021-09-28 12:06:52
Ansible
ENigma371, 2021-09-28 12:06:52

How to pass a command from one server group to another in Ansible playbook?

Tell me how you can transfer a command from group1 to group2 for example. In this block, you can see that I am executing a command, then I do register. How can I now transfer this command from group1 to another group, for example group2

name: Configure 
  hosts: group1
  become: yes
  tasks:
     - name: Kubeadm token
      command: kubeadm token create --print-join-command
      register: kubeadm_token

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MaxKozlov, 2021-09-28
@MaxKozlov

Maybe you are still passing not a command, but its result?
look towards delegate_to

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question