Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用salt将mysql转储文件导入vagrant_Mysql_Vagrant_Salt - Fatal编程技术网

用salt将mysql转储文件导入vagrant

用salt将mysql转储文件导入vagrant,mysql,vagrant,salt,Mysql,Vagrant,Salt,我正在使用vagrant with salt来设置开发环境,但是我找不到在salt配置中导入mysql脚本的方法,我使用了中的一个示例来解决这个问题。应用SQL后,将使用touch创建一个标记文件,稍后使用test进行检查: {% for file in [ '/usr/share/zabbix-server-mysql/salt-provided-schema.sql', '/usr/share/zabbix-server-mysql/salt-provided-images.sql'

我正在使用vagrant with salt来设置开发环境,但是我找不到在salt配置中导入mysql脚本的方法,我使用了中的一个示例来解决这个问题。应用SQL后,将使用
touch
创建一个标记文件,稍后使用
test
进行检查:

{% for file in [
  '/usr/share/zabbix-server-mysql/salt-provided-schema.sql',
  '/usr/share/zabbix-server-mysql/salt-provided-images.sql',
  '/usr/share/zabbix-server-mysql/salt-provided-data.sql'
] %}
{{ file }}:
  file:
    - managed
    - makedirs: True
    - source: {{ files_switch('zabbix', [ file ]) }}
  cmd:
    - run
    - name: /usr/bin/mysql -h {{ dbhost }} -u {{ dbuser }} --password={{ dbpass }} {{ dbname }} < {{ file }} && touch {{ file }}.applied
    - unless: test -f {{ file }}.applied
    - require:
      - file: {{ file }}
      - pkg: mysql-client
{% endfor %}
中的文件的
{%[
“/usr/share/zabbix server mysql/salt提供的schema.sql”,
“/usr/share/zabbix server mysql/salt提供的images.sql”,
“/usr/share/zabbix server mysql/salt提供的数据。sql”
] %}
{{file}}:
文件:
-管理
-马克迪尔斯:是的
-来源:{{files_开关('zabbix',[file])}
命令:
-跑
-名称:/usr/bin/mysql-h{{dbhost}}-u{{dbuser}}--password={{dbpass}}{{dbname}}}<{{file}}&&touch{{file}}。已应用
-除非:test-f{{file}}.applicated
-要求:
-文件:{{file}
-pkg:mysql客户端
{%endfor%}