Simple ansible roles and playbooks I've created for various personal projects
Create a virtualenv, you could use something like pyenv if you'd prefer
# virtualenv -p $(which python3) venv
# source venv/bin/activateInstall ansible
# pip install ansibleInstall dependent roles
# ansible-galaxy install -r requirements.yml -p ./roles- You will need 3 x 4GB VMs at a minimum with root ssh keys installed and configured
- Swap out the IP addresses in
inventories/pulsar - Review the defaults in
group_vars/pulsar.ymland adjust if needed
Note: All pulsar related configuration templates live in roles/configure_container/templates
- Run the
playbook_pulsar.ymlplaybook against all 3 nodes (The playbook will fail to run if you run it against a single node)
Note: Use bootstrap_pulsar_zookeeper=true only when creating a brand new and empty pulsar cluster
# ansible-playbook -i inventories/pulsar -e "bootstrap_pulsar_zookeeper=true" --limit pulsar playbook_pulsar.ymlIf you would like to start over and recreate the pulsar containers run this VERY DESTRUCTIVE command which will delete everything except for the very large pulsar docker image...
# ansible pulsar -i inventories/pulsar -m shell -b -a 'docker stop $(docker ps -qa); docker rm $(docker ps -qa); docker volume rm $(docker volume ls -q); docker network rm $(docker network ls -q); rm -rf /docker'You can now re-run playbook_pulsar.yml to deploy a new pulsar cluster
Run the playbook_ffmpeg.yml playbook to scan a directory of video files (eg. Movies or TV Shows)
and then have it automatically transcode the file to a smaller more stream friendly format (I use emby-server but could be useful for Plex as well)
# ansible-playbook -i localhost, playbook_ffmpeg.ymlYou can use the playbook_mailserver.yml playbook to configure an all-in-one
email server with the following components:
- postfix (smtp/mta)
- dovecot (mailboxes/imap)
- denyhosts (ssh/imap tarpit)
- roundcube (webmail)
- spamassassin
- nginx
- php-fpm
To use, set your desired defaults in group_vars/all and run ansible-playbook locally
on your future email server like so:
# ansible-playbook -i localhost, playbook_mailserver.ymlEmail users are standard local POSIX accounts combined with the postfix virtual mail map and can be added by simply running:
# adduser <username> --no-create-homeThen add an entry to the virtual map:
# vim /etc/postfix/virtual.map
# postmap /etc/postfix/virtual.map
# systemctl reload postfixOr better yet, add it to our ansible virtual.map.j2
template and rerun playbook_postfix.yml
# ansible-playbook -i localhost, playbook_postfix.ymlOnce the user connects to the imap server, verify the mailbox location now exists:
# ls -l /home/vmail