We have covered the most fundamental features of Ansible. Let's now forget, just for a little while, about Docker and configure a complete deployment step using Ansible. We will run the calculator service on one server and the Redis service on the second server.
Deployment with Ansible
Installing Redis
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: install Redis
apt:
name: redis-server
state: present
- name: start Redis
service:
name: redis-server
state: started
- name: copy Redis configuration
copy:
src: redis.conf
dest: /etc/redis/redis.conf
notify...