Hi,

Try replacing the hyphens with underscores are per documentation below.

https://docs.ansible.com/archive/ansible/2.4/playbooks_variables.html#what-makes-a-valid-variable-name

Regards



> On 8 Jun 2023, at 11:35, Kathy L <[email protected]> wrote:
> 
> I have what I thought was an easy problem to solve.  A client has several 
> different set ups of Debian 10 hosts.  We are using ansible to install 
> osqueryd and need to install the osqueryd.service file.   I am trying to 
> register the first result of the command:
> 
> "locate osqueryd.service."  
> 
> The error I am getting is:
>   "Invalid variable name is 'register' specified: 'osqueryd-service-file"
> 
> Here is my ansible code:
> 
>     - name: Locate osqueryd.service file
>       command: "locate osqueryd.service"
>       register: osqueryd-service-file
> 
>     - name: Print osqueryd.service file
>       debug:
>           msg: "osqueryd service file is 
> osqueryd-service-file.results.1.stdout"
> 
> I don't even get to the debug statement.  Why won't it let me register the 
> results of the locate command?
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/71d6a619-8e30-44e9-b18f-4557f3fc7387n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/71d6a619-8e30-44e9-b18f-4557f3fc7387n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/0B3161BE-9D9B-4CC4-AC54-46598F73804D%40gmail.com.

Reply via email to