salt
salt copied to clipboard
salt ext_pillar from mysql not working
Issue:- We want to use ext_pillar with mysql . we have created a table inside mysql with keys and values inside it. Now we want to pull that data . we followed the steps mentioned in doc but its not working.
mysql:
user: root
pass: root
db: provisioningdb
ext_pillar:
- mysql:
fromdb:
query: 'SELECT package_name,pillar_role,pillar_key,pillar_value
FROM PILLAR_ROLE
WHERE package_name LIKE %s'
depth: 2
as_list: True
=========================== mysql table:-
MariaDB [provisioningdb]> select * from PILLAR_ROLE;
+-----------+--------------+--------------------+------------+-----------------------------+
| pillar_id | package_name | pillar_role | pillar_key | pillar_value |
+-----------+--------------+--------------------+------------+-----------------------------+
| 1 | MongoDB | MongoDevParameters | port | 27017 |
| 2 | MongoDB | MongoDevParameters | dbpath | /srv/mongodb |
| 3 | MongoDB | MongoDevParameters | logpath | /var/log/mongodb/mongod.log |
| 4 | MongoDB | MongoDevParameters | logappend | true |
| 5 | MongoDB | MongoDevParameters | journal | true |
| 6 | MongoDB | MongoDevParameters | fork | true |
+-----------+--------------+--------------------+------------+-----------------------------+
now when we try to get pillar data salt * saltutil.refresh_pillar salt * pillar.data
postgrebox:
----------
fromdb:
----------
postgres:
----------
fixpack:
3
majorversion:
9
minorversion:
6
package:
postgres-server
repo:
yum
use_repo:
True
postgres.host:
localhost
postgres.maintenance_db:
postgres
postgres.pass:
postgres.port:
5432
postgres.user:
postgres
inst4:
----------
_errors:
- Error encountered while render pillar top file.
fromdb:
----------
master:
----------
_errors:
- Specified SLS 'dummy' in environment 'base' is not available on the salt master
fromdb:
----------
The key and value that it needs to match is the minion_id. The '%s' will be the minion id.
The ext_pillar is just a place to store each minions pillars.
It looks like package_name is MongoDB which is not the minions name?
Thanks, Daniel