Procházet zdrojové kódy

Fix user/database creation

tags/2016.12
Filip Pytloun před 8 roky
rodič
revize
e27aafb7a6
1 změnil soubory, kde provedl 4 přidání a 13 odebrání
  1. +4
    -13
      mongodb/server.sls

+ 4
- 13
mongodb/server.sls Zobrazit soubor



{%- for database_name, database in server.get('database', {}).iteritems() %} {%- for database_name, database in server.get('database', {}).iteritems() %}


mongodb_database_{{ database_name }}:
mongodb_user.present:
- name: {{ database_name }}
- passwd: {{ database.password }}
- user: admin
- password: {{ server.admin.password }}
{%- if server.members is defined %}
require:
- cmd: mongodb_setup_cluster
{%- endif %}

/var/tmp/mongodb_user_{{ database_name }}.js: /var/tmp/mongodb_user_{{ database_name }}.js:
file.managed: file.managed:
- source: salt://mongodb/files/user_role.js - source: salt://mongodb/files/user_role.js
- template: jinja - template: jinja
- mode: 600 - mode: 600
- user: root - user: root
- require:
- mongodb_user: {{ database_name }}
- defaults: - defaults:
database_name: {{ database_name }} database_name: {{ database_name }}


- file: /var/tmp/mongodb_user_{{ database_name }}.js - file: /var/tmp/mongodb_user_{{ database_name }}.js
- service: mongodb_service - service: mongodb_service
- creates: {{ server.lock_dir }}/mongodb_user_{{ database_name }}_created - creates: {{ server.lock_dir }}/mongodb_user_{{ database_name }}_created
{%- if server.members is defined %}
require:
- cmd: mongodb_setup_cluster
{%- endif %}


{%- endfor %} {%- endfor %}



Načítá se…
Zrušit
Uložit