c0ntax.wiremock
ansible-role-wiremock
=====================
This is a simple Ansible role that sets up one or more Wiremock servers to run.
Requirements
No special requirements needed.
Role Variables
You can customize the following settings:
wiremock_install: true
By default, this will install Wiremock. Set this to false
if you want to skip the installation (for example, in production).
wiremock_daemon: true
Installs Wiremock as an init V script. If set to false
, this will just download the jar file and place it in a suitable location.
wiremock_service_state: started
If wiremock_daemon
is true
, this controls how the service is managed (e.g., whether it's running).
wiremock_root_dir: /var/wiremock
This is the main directory for Wiremock mappings and other related files.
wiremock_servers:
- name: wiremock
port: 8080
root_dir: "{{ wiremock_root_dir }}"
This is crucial. It allows you to create multiple start scripts for different mocked services. Note: Make sure the name, port, and root_dir are unique to avoid conflicts. For example, you can set up multiple services like this:
wiremock_servers:
- name: wiremock-oauth
port: 8080
root_dir: "{{ wiremock_root_dir }}/oauth"
enable_local_response_templating: true
enable_global_response_templating: false
- name: wiremock-service-1
port: 8081
root_dir: "{{ wiremock_root_dir }}/service-1"
enable_local_response_templating: false
- name: wiremock-service-2
port: 8082
root_dir: "{{ wiremock_root_dir }}/service-2"
Things You Probably Shouldn't Change:
wiremock_version: 2.17.0
wiremock_src: "http://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-standalone/{{ wiremock_version }}/wiremock-standalone-{{ wiremock_version }}.jar"
wiremock_original: "/usr/share/java/wiremock-standalone-{{ wiremock_version }}.jar"
wiremock_dest: /usr/share/java/wiremock-standalone.jar
This controls where Wiremock is installed and which version is downloaded.
wiremock_user: nobody
wiremock_group: nogroup
This sets which user and group Wiremock will run under.
Dependencies
- geerlingguy.java
Example Playbook
- hosts: servers
roles:
- { role: c0ntax.wiremock, wiremock_install: true, wiremock_daemon: true }
License
Apache-2.0
A simple role to run one or more wiremock servers
ansible-galaxy install c0ntax.wiremock