salt stack - Mysql Grant root permission for any host -
i trying install mysql using salt-stack on ec2 instance. add grant root user. should accessible host using password.
here's state file:
mysql-server: pkg: - installed - pkgs: - mysql-server - python-mysqldb service: - running - name: mysql - enable: true - require: - pkg: mysql-server - watch: - file: /etc/mysql/my.cnf mysql_user: - present - name: root - password: {{ pillar['mysql']['server']['root_password'] }} - require: - service: mysql /srv/.my.cnf: file: - managed - source: salt://files/mysql/app-my.cnf - user: app - group: app - mode: 0600 - template: jinja - require: - user: app /root/.my.cnf: file: - managed - source: salt://files/mysql/root-my.cnf - user: root - group: root - mode: 0600 - template: jinja {{pillar.default_database.name}}: mysql_database.present mysql-app-user: mysql_user.present: - name: app - host: '%' - password: {{ pillar['mysql']['server']['root_password'] }} - connection_user: root - connection_pass: {{ pillar['mysql']['server']['root_password'] }} - connection_charset: utf8 - saltenv: - lc_all: "en_us.utf8" - require: - service: mysql mysql-app-local-user: mysql_user.present: - name: app - host: localhost - password: {{ pillar['mysql']['server']['root_password'] }} - connection_user: root - connection_pass: {{ pillar['mysql']['server']['root_password'] }} - connection_charset: utf8 - saltenv: - lc_all: "en_us.utf8" - require: - service: mysql mysql_root_remote_grant: mysql_grants.present: - grant: privileges - database: '*.*' - user: root mysql_app_remote_grant: mysql_grants.present: - grant: privileges - database: '*.*' - user: app mysql_app_local_grant: mysql_grants.present: - grant: privileges - database: '*.*' - user: app - host: localhost
this part gives access host without password.
mysql_root_remote_grant: mysql_grants.present: - grant: privileges - database: '*.*' - user: root
this works, grants access root host without password. don't know doing wrong here. how make root accessible host using password salt-stack install?
here's how solved it, had add root
-mysql_user.present
%
(any host) below.
mysql-root-user-remote: mysql_user.present: - name: root - host: '%' - password: {{ pillar['mysql']['server']['root_password'] }} - connection_user: root - connection_pass: {{ pillar['mysql']['server']['root_password'] }} - connection_charset: utf8 - saltenv: - lc_all: "en_us.utf8" - require: - service: mysql
so there 2 mysql_user.present
declaration of root
user 1 localhost , host. after mysql_grant.present
works.
Comments
Post a Comment