I have a role that sets up a redis cluster. This is your typical redis install with a master, replica and a sentinel running on three different hosts.
I have this molecule file:
(venvpy36) [russell.cecala@russells-vm default]$ cat molecule.yml
---
dependency:
name: galaxy
driver:
name: podman
platforms:
- name: redis-master.example.com
image: oraclelinux:9
tmpfs:
- /run
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
command: "/usr/sbin/init"
privileged: true
pre_build_image: true
groups:
- cluster
- newsp
exposed_ports:
- 6379
- 26379
networks:
- name: podman
links:
- redis-replica.example.com
- redis-sentinel.example.com
- name: redis-replica.example.com
image: oraclelinux:9
tmpfs:
- /run
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
command: "/usr/sbin/init"
privileged: true
pre_build_image: true
groups:
- cluster
- newsp
exposed_ports:
- 6379
- 26379
networks:
- name: podman
links:
- redis-master.example.com
- redis-sentinel.example.com
- name: redis-sentinel.example.com
image: oraclelinux:9
tmpfs:
- /run
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
command: "/usr/sbin/init"
privileged: true
pre_build_image: true
groups:
- cluster
- newsp
exposed_ports:
- 6379
networks:
- name: podman
links:
- redis-master.example.com
- redis-replica.example.com
provisioner:
name: ansible
inventory:
links:
host_vars: ./inventory/host_vars
group_vars: ./inventory/group_vars
verifier:
name: ansible
When I run molecule converge and log on to each of the containers I find they all have the same IP address.
$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f757241cb210 container-registry.oracle.com/os/oraclelinux:9 /usr/sbin/init 24 minutes ago Up 24 minutes ago redis-master.example.com
ea5bfcb009dc container-registry.oracle.com/os/oraclelinux:9 /usr/sbin/init 24 minutes ago Up 24 minutes ago redis-replica.example.com
e4d02d1bec29 container-registry.oracle.com/os/oraclelinux:9 /usr/sbin/init 24 minutes ago Up 24 minutes ago redis-sentinel.example.com
[root@redis-master /]# ip a | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
inet6 fd00::3c58:e3ff:fe22:5597/64 scope global dynamic mngtmpaddr
inet6 fe80::3c58:e3ff:fe22:5597/64 scope link
The other two containers have the same ...
[root@redis-replica /]# ip a | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
inet6 fd00::6415:d7ff:fe99:97cd/64 scope global dynamic mngtmpaddr
inet6 fe80::6415:d7ff:fe99:97cd/64 scope link
How can I get all three of the containers have different IPs and will they be able to connect to each other?