On Mon, 4 May 2020 11:55:19 -0700 (PDT)
Justin Nelson <[email protected]> wrote:

> - name: Update File
>   hosts: test_group
>   ...
>   tasks:
>   ...      
>     - name: Update test file
>       lineinfile:
>         path: /var/tmp/test.yaml
>         regexp: "^\ \ test[.-]{{ test_string|lower }}:.*"
>         line: "  test-{{ test_string|lower }}: {{ mac }}"
> 
> My test_group has two hosts:
> 
> [test_group]
> host1
> host2
>
> ...
>
> When run, I expect to have both hosts with an entry in /var/tmp/test.yaml 
> similar to:
> 
> mac_list:
>   test-abc: 01:23:45:67:89:ab
>   test-xyz: ab:09:87:65:43:21

The file '/var/tmp/test.yaml' is on the remote host. Each host updates its
own instance. I can only assume the file should be on the controller, e.g.

     - name: Update test file
       lineinfile:
         path: /var/tmp/test.yaml
         regexp: "^\ \ test[.-]{{ test_string|lower }}:.*"
         line: "  test-{{ test_string|lower }}: {{ mac }}"
       delegate_to: localhost

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/20200504221738.7923f4d9%40gmail.com.

Attachment: pgpGwqUkChCSD.pgp
Description: OpenPGP digital signature

Reply via email to