【问题标题】:importing mysql dumping file to vagrant with salt用盐将mysql转储文件导入vagrant
【发布时间】:2016-02-24 04:52:04
【问题描述】:

我正在使用 vagrant 和 salt 来设置开发环境,但我找不到在 salt 配置中导入 mysql 脚本的方法

【问题讨论】:

    标签: mysql vagrant salt


    【解决方案1】:

    我重新使用了来自this script 的示例来解决它。应用 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 %}
    

    【讨论】:

      猜你喜欢
      • 2012-03-02
      • 1970-01-01
      • 2013-09-06
      • 1970-01-01
      • 2018-08-15
      • 1970-01-01
      • 2016-10-23
      • 2021-04-11
      • 2013-10-05
      相关资源
      最近更新 更多