[Unit]
Description=Cassandra Container
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull cassandra:3.10
ExecStart=/usr/bin/docker run --name %n -v /srv/lib/cassandra:/var/lib/cassandra \
 -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 \
 -e CASSANDRA_BROADCAST_ADDRESS={{ansible_default_ipv4.address}} \
 -e CASSANDRA_START_RPC=True \
 {{run_options}} cassandra:3.10

[Install]
WantedBy=multi-user.target