Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [root@salt-server1 _grains]# cat /srv/salt/mariadb/user/reviewboard-users.sls
- {%- set root_pass = salt['pillar.get']('admin_pass') %}
- {%- set root_pass_raw = salt['pillar.get']('admin_pass_raw') %}
- {%- set review_pass = salt['pillar.get']('review_pass') %}
- {%- if salt['grains.get']('initiall_state_run', True) %}
- root:
- mysql_user.present:
- - host: localhost
- {%- if root_pass is defined %}
- - password_hash: '{{ root_pass }}'
- {%- endif %}
- require:
- - pkg: mysql-python
- - pkg: mariadb-client
- - service.running: mariadb
- grains.present:
- - name: initiall_state_run
- - value: False
- {%- endif %}
- root-pwd:
- mysql_user.present:
- - name: root
- - host: localhost
- {%- if root_pass is defined %}
- - password_hash: '{{ root_pass }}'
- {%- endif %}
- - connection_host: localhost
- - connection_user: root
- - connection_pass: '{{ root_pass_raw }}'
- - connection_charset: utf8
- require:
- - pkg: mysql-python
- - pkg: mariadb-client
- - service.running: mariadb
- - onfail:
- - mysql_user: root
- review:
- mysql_user.present:
- - host: localhost
- {%- if review_pass is defined %}
- - password_hash: '{{ review_pass }}'
- {%- endif %}
- - connection_host: localhost
- - connection_user: root
- - connection_pass: '{{ root_pass_raw }}'
- - connection_charset: utf8
- require:
- - pkg: mysql-python
- - pkg: mariadb-client
- - service.running: mariadb
- [root@salt-server1 _grains]# cat initial_state_run_grain.py
- #!/usr/bin/env python
- def _initial_state_run_grain():
- initial_state_run = {'initiall_state_run': 'True'}
- return initial_state_run
- def main():
- grains = {}
- grains['custom_object_grains'] = _initial_state_run_grain()
- return grains
Add Comment
Please, Sign In to add comment