My apologies for not being a little more clear, Vlado.

I do want this to execute on the local host and not on the remote hosts. 
Ultimately this will be setting up a file that will be used later for 
building a remote host's config file using the template module. It's all a 
part of an attempt at a somewhat zero touch provisioning model for switches 
we deploy.

Essentially the work flow would look similar to:

a new device needs to be added => user builds initial config file specific 
to device location and requirements  => user runs playbook

The playbook would then locally:
    load the device variables from the config file
    take user's config file and make a backup to the host_vars directory 
for later use, if necessary
    take a short hostname (test_string) and MAC address and append them to 
the file

Later in the playbook other plays will have tasks that load the variables 
in these files generate a config from a template that gets copied to the 
remote host. This one file and its contents is, sort of, a living file that 
gets updated every time we add or replace a device.

Hope that makes sense.


On Monday, May 4, 2020 at 4:03:15 PM UTC-4, Vladimir Botka wrote:
>
> On Mon, 4 May 2020 11:55:19 -0700 (PDT) 
> Justin Nelson <[email protected] <javascript:>> wrote: 
>
> > ... When I run my playbook I can only seem to get one of my two hosts 
> ... 
> > 
> > - name: Update File 
> >   hosts: 
> >     - test_group 
> >   connection: local 
> > 
> > [...] 
> > 
> > [test_group] 
> > host1 
> > host2 
> > 
> > [...] 
> > 
> > What am I missing to make this work for both hosts? 
>
> Remove "connection: local". See "local – execute on controller" 
>
> https://docs.ansible.com/ansible/latest/plugins/connection/local.html#local-execute-on-controller
>  
>
>   "... allows ansible to execute tasks on the Ansible ‘controller’ instead 
> of 
>   on a remote host." 
>
> HTH, 
>
>         -vlado 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7dcf3c22-e24e-4cb6-b5d3-21718ad6fc90%40googlegroups.com.

Reply via email to