Hi guys,

On 07.02.17 22:19 Johannes Kastl wrote:

> Yeah, I just found out, too. But now I have to see how to set a
> variable for a host, that can not be reached at this point in time.
> Delegate_to with set_fact? I'll try...

I can't get the syntax right for setting a hostvar with set_fact.

The newly created file in the host_vars directory is apparently not
read during a playbook run, even if there are multiple plays inside it.

I tried to include the file with include_vars, but can't get the
namespace right, so the variable foobar inside the yml file is put
into the hostvars of host xyz.

Also, set_fact with delegate_to does not set the variable.

The background is that I am creating a new lxc container on a machine,
whose ssh host pubkey I want to have in my known_hosts to avoid
unknown-hostkey-prompt durinng an ansible run...

So my workflow is
- creating the container
- ssh-keyscan from the host
- write the results into a file in host_vars/xyz/
- update my known_hosts which uses a for-loop for all containers on
the lxc host
- connect to the container without prompt
- and bootstrap it

Maybe I am abusing ansible right now, but at the moment this seems to
be the easiest approach without blindly accepting ssh host keys...

Johannes

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/02b6e85c-fe36-8b53-e87a-dce517ded261%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to