Other Ansible could not resolve community.mysql.mysql_query

Alain De Vos

Son of Beastie

Reaction score: 763
Messages: 2,512

ERROR given,
couldn't resolve module/action 'community.mysql.mysql_query'. This often indicates a misspelling, missing collection, or incorrect module path.
As first question is it available in freebsd ?
Code:
ansible-galaxy collection install community.mysql
Finishes without errors
But code maria.yml,
Code:
- name: get maria
      community.mysql.mysql_query:
        login_db: "{{db_name}}"
        login_user: "{{db_user}}"
        login_password: "{{db_password}}"
        query: SELECT * FROM "{{db_table}}"
      register: queryresult
Spits out
Code:
ERROR! couldn't resolve module/action 'community.mysql.mysql_query'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/usr/home/x/Root/Db/maria/ansible_error/maria.yml': line 18, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
    - name: get maria
      ^ here
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,717
Messages: 39,308

You have too many spaces:
Code:
- name: get maria
  community.mysql.mysql_query:
    login_db: "{{db_name}}"
    login_user: "{{db_user}}"
    login_password: "{{db_password}}"
    query: SELECT * FROM "{{db_table}}"
  register: queryresult
Yes, YAML is really, really finicky about it's spaces and indentations.

Set this in ~/.vimrc, it'll help:
Code:
au BufRead,BufNewFile *.yml,*.yaml,*.eyaml set ft=yaml
autocmd FileType yaml setlocal shiftwidth=2 softtabstop=2

set softtabstop=2
set shiftwidth=2
set smarttab
set expandtab
 
Top