Guest User

Untitled

a guest
Oct 30th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. [root@salt-server1 _grains]# cat /srv/salt/mariadb/user/reviewboard-users.sls
  2. {%- set root_pass = salt['pillar.get']('admin_pass') %}
  3. {%- set root_pass_raw = salt['pillar.get']('admin_pass_raw') %}
  4. {%- set review_pass = salt['pillar.get']('review_pass') %}
  5.  
  6.  
  7. {%- if salt['grains.get']('initiall_state_run', True) %}
  8. root:
  9. mysql_user.present:
  10. - host: localhost
  11. {%- if root_pass is defined %}
  12. - password_hash: '{{ root_pass }}'
  13. {%- endif %}
  14. require:
  15. - pkg: mysql-python
  16. - pkg: mariadb-client
  17. - service.running: mariadb
  18. grains.present:
  19. - name: initiall_state_run
  20. - value: False
  21. {%- endif %}
  22.  
  23. root-pwd:
  24. mysql_user.present:
  25. - name: root
  26. - host: localhost
  27. {%- if root_pass is defined %}
  28. - password_hash: '{{ root_pass }}'
  29. {%- endif %}
  30. - connection_host: localhost
  31. - connection_user: root
  32. - connection_pass: '{{ root_pass_raw }}'
  33. - connection_charset: utf8
  34. require:
  35. - pkg: mysql-python
  36. - pkg: mariadb-client
  37. - service.running: mariadb
  38. - onfail:
  39. - mysql_user: root
  40.  
  41. review:
  42. mysql_user.present:
  43. - host: localhost
  44. {%- if review_pass is defined %}
  45. - password_hash: '{{ review_pass }}'
  46. {%- endif %}
  47. - connection_host: localhost
  48. - connection_user: root
  49. - connection_pass: '{{ root_pass_raw }}'
  50. - connection_charset: utf8
  51. require:
  52. - pkg: mysql-python
  53. - pkg: mariadb-client
  54. - service.running: mariadb
  55.  
  56. [root@salt-server1 _grains]# cat initial_state_run_grain.py
  57. #!/usr/bin/env python
  58.  
  59.  
  60. def _initial_state_run_grain():
  61. initial_state_run = {'initiall_state_run': 'True'}
  62. return initial_state_run
  63.  
  64. def main():
  65. grains = {}
  66. grains['custom_object_grains'] = _initial_state_run_grain()
  67. return grains
Add Comment
Please, Sign In to add comment