AutolabJS/AutolabJS

View on GitHub
deploy/plays/mysqldb.yml

Summary

Maintainability
Test Coverage
- hosts: mysqldb
  become: yes
  tasks:
    - name: Give permissions to mysqld over directories
      shell: bash helper_scripts/mysql_log.sh
      args:
        chdir: "{{install_dir}}/deploy/plays"

    - name: Build MySQL Container
      docker_container:
        name: autolabjs-db
        image: "autolabjs/mysql:5.7.4"
        detach: yes
        network_mode: host
        volumes:
          - "/etc/localtime:/etc/localtime:ro"
          - "{{ install_dir }}/mysql:/var/lib/mysql"
          - "{{ install_dir }}/log/mysql:/var/log/mysql"
          - "{{ install_dir }}/deploy/configs/db/conf.d:/etc/mysql/conf.d"
          - "{{ install_dir }}/deploy/configs/db/my.cnf:/etc/mysql/my.cnf"
        env:
          MYSQL_ROOT_PASSWORD: "{{ mysql_root_pass }}"

    - name: Transfer wait-for-it
      copy: src=./helper_scripts/wait-for-it.sh dest=/tmp/wait-for-it.sh mode=0777

    - name: Waiting for MySQL server to be up
      shell: ./helper_scripts/wait-for-it.sh -t 60 {{ db_hostname }}:3306

    - pause: seconds=10

    - name: Create AutolabJS database
      command: docker exec autolabjs-db bash -c "mysql -e 'CREATE DATABASE AutolabJS'"