ansible playbook samples

playbook setup

as user

mkdir ~/dev/ansible/playbooks/
cd ~/dev/ansible/playbooks/

see playbooks

ready to go

easy-peasy w/o secrets

    ANSIBLE_DISPLAY_SKIPPED_HOSTS=false ansible-playbook tasks-sshguard.yml -i hosts

with secrets

vi credentials.bash

tsdb_host=
tsdb_port=443
tsdb_http_user=
tsdb_http_passwd=

log_host=
log_port=9200
log_http_user=
log_http_passwd=

source credentials.bash

deploy the base config incl. flb sshguard

    ANSIBLE_DISPLAY_SKIPPED_HOSTS=false ansible-playbook tasks-flb-setup.yml -i hosts \
    --extra-vars "tsdb_host=$tsdb_host" \
    --extra-vars "tsdb_port=$tsdb_port" \
    --extra-vars "tsdb_http_user=$tsdb_http_user" \
    --extra-vars "tsdb_http_passwd=$tsdb_http_passwd" \
    --extra-vars "log_host=$log_host" \
    --extra-vars "log_port=$log_port" \
    --extra-vars "log_http_user=$log_http_user" \
    --extra-vars "log_http_passwd=$log_http_passwd" \
    --check

and some addons

    ANSIBLE_DISPLAY_SKIPPED_HOSTS=false ansible-playbook tasks-flb-nginx.yml -i hosts ...

and then w/o --check

additional notes

fetch some informations/variables to help you design playbook

    ansible HOST -m setup

resources

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_repository_module.html


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun