1

I am trying to share some variables between multiple hosts in a playbook, and am using the technique described in this stack overflow question. It works, however each run ansible complains that the dummy host (K8S_MASTER_CA_HASH) does not exist, so it can't gather facts about it.

Is it possible to tell ansible not to gather facts for a single host in a play run against various hosts?

I tried using 'localhost' as the dummy host to hold the variables, but then ansible complains it can't ssh to localhost. (Seems like wrong approach)

TSG
  • 4,242
  • 9
  • 61
  • 121
  • You can try the play level `connection` keyword for localhost to prevent Ansible from trying an SSH connection, like `connection: local`. – seshadri_c Sep 11 '21 at 15:55
  • using localhost seems to be the wrong approach. A 'dummy' host as suggested makes most sense, I just can't tell ansible how to not gather facts on that dummy host – TSG Sep 11 '21 at 16:19
  • Having a separate play for dummy host with `gather_facts: false`, could be an option in that case. – seshadri_c Sep 12 '21 at 04:19

0 Answers0