flyway

flyway

Installs and configures flyway commandline tool from http://flywaydb.org/getstarted/download.html. It installs files to /opt/flyway and creates symlink from /usr/bin/flyway to the binary in the /opt/flyway.

Change: now role use ssl by default. Set flyway_use_ssl: false to fall back to HTTP.

Requirements

Ansible 1.4+. You'll need java on the host to use flyway, but this role will succeed even without java.

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 postgress and oracle)
      • host: db hostname or IP
      • port: 5432
      • name: database name
      • user: username
      • password: password for username
    • schemas: schemas to manage
  • flyway_table: flyway table (default schema_history)
  • flyway_locations: path to sql migrations (with 'filesystem:' prefix if needed, see examples)
  • flyway_symlink_location: place for executable symlink (default: /usr/bin)
  • flyway_use_ssl: Use SSL or not to download binary (default: yes)
  • flyway_validate_ssl_cert: validate or not server SSL certificate at download time (default: yes)

Dependencies

None

Example Playbook (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/

Configuration tested with Postgres 9.2.

Example Playbook (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

Configuration tested with Oracle XE 11.

Note: To use flyway with Oracle you need to copy the driver jar to flyway:

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

License

BSD

Author Information

(c) George Shuklin 2015-2018, rastaman 2015

About

Install flyway command line tool from www.flywaydb.org

Install
ansible-galaxy install amarao/ansible-flyway
GitHub repository
License
Unknown
Downloads
24233