OK, thank you. I think I am getting closer.  I installed as the normal 
user.  Now I am just getting another error.  This is the file:

---
- name: Select trunk name from pbx
  hosts: demoserver
  become: true
  become_user: root


- name: get trunk names
community.mysql.mysql_query:
    login_db: asterisk
    login_user: root
    login_password:
    query: SELECT * FROM trunks
...

This is the error now:

ERROR! We were unable to read either as JSON nor YAML, these are the errors 
we got from each:
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.
  did not find expected '-' indicator

The error appears to be in '/etc/ansible/playbooks/get_trunk_name.yml': 
line 9, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: get trunk names
community.mysql.mysql_query:
^ here

On Saturday, September 18, 2021 at 10:13:22 AM UTC-4 wne...@gmail.com wrote:

> Hi,
>
>
> > On 18.09.2021, at 14:28, Adam <adam.f...@gmail.com> wrote:
> > 
> > SO this is what happens when I check if the module exists when logged in 
> as a normal user:
> > 
> > 
> > [WARNING]: module community.mysql.mysql_query not found in:
> > 
> /home/normaluser/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:/usr/lib/python3.6/site-
> > packages/ansible/modules
> > 
> > If I run that same check when logged in as root, it appears like I get 
> the appropriate output with mysql information. 
>
> SO, you installed the collection as root, probably into 
> /root/.ansible/plugins/modules
> unprivileged normaluser does not have /root/.ansible/plugins/modules in the
> $ANSIBLE_COLLECTIONS_PATHS
>
> one solution would be: install it again as normaluser
>
> > 
> > But I still get the error when running the syntax check:
> > 
> > ERROR! 'community.mysql.mysql_query' is not a valid attribute for a Play
> > 
> > The error appears to be in '/etc/ansible/playbooks/get_trunk_name.yml': 
> line 12, column 3, but may
> > be elsewhere in the file depending on the exact syntax problem.
> > 
> > The offending line appears to be:
> > 
> > 
> > - name: get trunk names
> > ^ here
>
> SO, syntax went wrong? Wrong indentation?
>
> ```
> - name: get trunk names
> community.mysql.mysql_query:
> ```
>
> it should be (note the spaces)
>
> ```
> - name: get trunk names
> community.mysql.mysql_query:
> ```
>
> Best Regards, Markus

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3eb1c218-3c34-4b11-898b-c72e9efc1f83n%40googlegroups.com.

Reply via email to