GithubHelp home page GithubHelp logo

liweitianux / ansible-dfly-vps Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 0.0 239 KB

Ansible Playbooks for Personal DragonFly BSD Server

License: MIT License

Shell 67.09% Python 32.91%
ansible dragonflybsd vps

ansible-dfly-vps's Introduction

Ansible Playbooks for Personal DragonFly BSD Server

Aaron LI

Created: 2018-02-14

Ansible: 2.7.7 (Python 3.7.3)

Introduction

An Ansible playbook to manage a very small (read 512MB RAM) VPS to self-host various services including:

  • DNS (NSD for authoritative DNS service)
  • Email (Postfix, Dovecot)
  • Web (Nginx, acme-client for Let's Encrypt certificates)
  • CalDAV/CardDAV (Radicale with uWSGI)
  • Git (Web interface via cgit with uWSGI)
  • IRC Bouncer (ZNC)

Playbooks

  • bootstrap.yml: Bootstrap the remote host (e.g., a VPS) after installing DragonFly BSD.

    NOTE:

    • Use the bootstrap.sh script instead.
    • The new host should be configured that allow root ssh into it using a password. (This will be disabled during the bootstrap.)
  • deploy.yml: The main playbook that deploys services on the target host.

Configurations

  • ansible.cfg Ansible configuration file

  • inventory.yml Remote host specifications

  • group_vars/all/vars.yml Variables for hosts in the all group, i.e., all hosts

  • group_vars/all/vault.yml Encrypted variables that will merged into the above vars.yml upon Ansible playing the playbook.

  • host_vars/vultr Variables specific to this host.

Roles

  • bootstrap Only used in the bootstrap.yml playbook to bootstrap a newly installed DragonFly BSD host.

  • basic Basic settings, includes:

    • Tune basic services in /etc/rc.conf
    • Set some system tunables in /boot/loader.conf
    • Enable /var/log/console.log in syslog
    • Tune csh/tcsh
    • Tweak pkg and install basic packages
  • security

    • Setup PF firewall
    • Enable sshlockout
  • dns

    • Setup local DNS cache with Unbound
    • Configure NSD as the authoritative name server in hidden master mode for several personal domains
  • web

    • Obtain SSL/TLS certificates from Let's Encrypt, as well as for other services (SMTP, IMAP, CalDAV/CardDAV, ZNC).
    • Serve personal website
    • Serve CalDAV/CardDAV via Radicale
    • Serve git repositories via cgit
    • Useful reverse proxies to popular websites
  • mail

    • SMTP client & server by Postfix
    • IMAP server by Dovecot
    • DKIM signing via OpenDKIM
    • SPF, DKIM, DMARC records managed through NSD above
    • Do not use database
    • No web interface
  • git

    • Self-host Git repositories
    • Web interface via cgit
    • Also manage and deploy the static resources of cgit via a Git repo
  • shadowsocks Setup ShadowSocks-libev for a useful proxy.

  • znc Setup ZNC IRC bouncer connecting to channel #dragonflybsd on EFNet.

  • radicale Setup Radicale as a lightweight CalDAV/CardDAV server for personal calendars and contacts. Served via Nginx and uWSGI.

Extensions

  • filter_plugins/ Custom template filters

Usages

  • Bootstrap the remote host:

    $ sh bootstrap.sh
    

    NOTE: The remote host should be configured to allow SSH root login, which will be disabled later to enhance security.

  • Test host connection:

    $ ansible vultr -m ping
    
  • List tasks:

    $ ansible-playbook deploy.yml -v --list-tasks
    
  • Run (check only but don't make changes) the whole playbook:

    $ ansible-playbook deploy.yml -vD [--check]
    
  • Run the playbook from a specific task:

    $ ansible-playbook deploy.yml -vD --step --start-at-task="..."
    
  • Run the tasks with specific tags:

    $ ansible-playbook deploy.yml -vD --tags="..."
    
  • View and edit the encrypted variables:

    $ ansible-vault view group_vars/all/vault.yml
    $ ansible-vault edit group_vars/all/vault.yml
    

References

License

The MIT License

ansible-dfly-vps's People

Contributors

liweitianux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.