We have covered the most fundamental features of Ansible. Now, let's forget, just for a little while, about Docker, Kubernetes, and most of the things we've learned so far. Let's configure a complete deployment step by only using Ansible. We will run the calculator service on one server and the Hazelcast service on the second server.
We can specify a play in the new playbook. Let's create the playbook.yml
file, with the following content:
---
- hosts: web1
become: yes
become_method: sudo
tasks:
- name: ensure Java Runtime Environment is installed
apt:
name: default-jre
state: present
update_cache: yes
- name: create Hazelcast directory
file:
path: /var/hazelcast
state: directory
- name: download Hazelcast
get_url:
url: https://repo1.maven.org/maven2/com/hazelcast/hazelcast/3.12/hazelcast-3.12.jar
dest: /var/hazelcast/hazelcast.jar
mode: a+r
- name: copy Hazelcast starting...