amarao.flyway

Flyway

This role installs and sets up the Flyway command-line tool from http://flywaydb.org/getstarted/download.html. It saves files in the /opt/flyway directory and creates a shortcut from /usr/bin/flyway to the program in /opt/flyway.

Update: The role now uses SSL by default. Set flyway_use_ssl: false to switch back to HTTP.

Requirements

You need Ansible version 1.4 or higher. Java needs to be installed on the host machine to use Flyway, but the role can still work without it.

Role Variables

All variables are optional.

  • fly_version: (default: "4.2.0")
  • flyway_download_url: (default: "https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/%s/flyway-commandline-%s.tar.gz")
  • flyway_root: (default: /opt/flyway)
  • flyway_config:
    • database:
      • dbms: (Tested with Postgres and Oracle)
      • host: database host name or IP address
      • port: 5432
      • name: database name
      • user: user name
      • password: password for the user
    • schemas: schemas to manage
  • flyway_table: Flyway table (default is schema_history)
  • flyway_locations: path to SQL migration files (add 'filesystem:' at the start if needed; see examples)
  • flyway_symlink_location: where to create the executable shortcut (default: /usr/bin)
  • flyway_use_ssl: use SSL for downloading the program or not (default: yes)
  • flyway_validate_ssl_cert: validate the server's SSL certificate during download (default: yes)

Dependencies

None

Example Playbook (for Postgres)

- hosts: javadb
  roles:
     - flyway
  vars:
     - flyway_root: /opt/flyway
     - flyway_config:
        database: 
          host: localhost
          port: 5432
          dbms: postgresql
          name: example
          user: postgres
          password: postgres
        schemas: public, myschema
     - flyway_locations: filesystem:/opt/migrations/

This configuration has been tested with Postgres version 9.2.

Example Playbook (for Oracle)

- hosts: oracledb
  roles:
     - { role: flyway }
  vars:
    - flyway_driver: oracle.jdbc.OracleDriver
    - flyway_config:
       database:
       dbms: oracle
       host: localhost
       port: 1521
       name: XE
       user: APP
       password: appsecret
       schemas: APP
    - flyway_locations: filesystem:/opt/migrations/full,filesystem:/opt/migrations/demo

This configuration has been tested with Oracle XE version 11.

Note: To use Flyway with Oracle, you must copy the JDBC driver jar file to the Flyway folder:

- name: Copy Oracle JDBC driver to the Flyway folder
  copy: src=./lib/ojdbc6-11.1.0.7.0.jar dest=/opt/flyway/flyway-{{ flyway_version }}/drivers
  sudo: yes

License

BSD License

Author Information

(c) George Shuklin 2015-2018, rastaman 2015

Informazioni sul progetto

Install flyway command line tool from www.flywaydb.org

Installa
ansible-galaxy install amarao.flyway
Licenza
Unknown
Download
29.7k
Proprietario