Coder Social home page Coder Social logo

equinoxel / ansible-role-swag Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 11 KB

Swag installer for Linux (via Docker)

Home Page: https://www.laurivan.com/ansible-install-swag-in-docker/

License: MIT License

Jinja 100.00%
ansible docker gateway role secure

ansible-role-swag's Introduction

Role Name

SWAG installer for linux

Role Variables

This role uses the variables listed below, along with default values (see defaults/main.yml).

Docker

You can specify the docker container name and version:

swag_container_name: "swag"
swag_image_version: "latest"

Swag will run by default as user 1000:1000:

swag_uid: 1000
swag_gid: 1000

You will need to define volumes to store data permanently. swag_data defines the location where SWAG stores its files (default site, configuration, certs...). You can define a separate swag_config volume to store its configuration data (e.g. for backup).

swag_data: "/mnt/data/swag"
swag_config: "{{ swag_data }}/config"

Note: This role supports path-defined volumes (not named volumes) right now.

You will need to specify the HTTP and HTTPS ports:

swag_port_http: 3080
swag_port_https: 3443

You can also customise the timezone:

swag_tz: "Europe/Brussels"

Domains and certificates

You need to specify your main domain and subdomains (if any):

swag_url: "example.com"
swag_validation: "dns"
swag_subdomains: 
swag_onlysubdomains: "false"

If you use a provider for certificates, you need to specify a set of common values:

swag_certprovider: # implicitly letsencrypt
swag_propagation:
swag_duckdnstoken:
swag_email: "[email protected]"
swag_extra_domains: 
swag_staging: "false"

Please use swag_staging: "true" while setting up and change it to "false" once you're ready. This way, you'll avoid hitting letsencrypt's query limits.

DNS

This role allows you to set up the DNS configuration/plugin via a template. You can define the template via the swag_dns_config parameter, where src specifies the location of the template and dst defines the destination name like so:

swag_dnsplugin: "cloudflare"
swag_dns_config:
  src: "cloudflare.ini.j2"
  dst: "cloudflare.ini"

This template replicates the one defined in SWAG:

# Instructions: https://github.com/certbot/certbot/blob/master/certbot-dns-cloudflare/certbot_dns_cloudflare/__init__.p># Replace with your values

{% if not cloudflare_api_token %}
# With global api key:
dns_cloudflare_email = {{ swag_email }}
dns_cloudflare_api_key = {{ cloudflare_api_key }}
{% else %}

# With token (comment out both lines above and uncomment below):
dns_cloudflare_api_token = {{ cloudflare_api_token }}
{% endif %}

In this case, you'll need to define the cloudflare credentials:

cloudflare_api_token:
cloudflare_api_key:

At the moment of writing this role, I use cloudflare. You can define your own plugin and template.

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
  roles:
      - laurivan.swag

License

MIT

Author Information

This role was created in 2022 by Laur Ivan

ansible-role-swag's People

Contributors

equinoxel avatar

Watchers

 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.