Skip to content

Instantly share code, notes, and snippets.

View VladislavMS's full-sized avatar

Vladislav Stoyanov VladislavMS

View GitHub Profile
@VladislavMS
VladislavMS / docker-volumes-backup.yml
Created August 9, 2022 15:25 — forked from gustavomcarmo/docker-volumes-backup.yml
Ansible playbook to backup all Docker volumes in a remote host and then upload the backup file to a raw Nexus repository.
---
- hosts: remote
gather_facts: no
tasks:
- name: Make the volumes backup
archive:
path: /var/lib/docker/volumes
dest: volumes.tar.gz
- name: Make the backup available (requires vault-password-file)
uri:

Loading variables from .env files in Ansible

Ansible has various ways of looking up data from outside sources, including plain text password files, CSV files and INI files. But it doesn't seem to have a lookup for .env files, as used in Laravel projects, also available for PHP, Ruby, Node.js, Python and others.

One option is to launch Ansible with the Ruby dotenv command line script... But that requires Ruby, which seems like overkill to me.

So here is a simpler solution that I use. It consists of:

  1. The .env file itself
  2. A small shell script that loads the .env file into environment variables - ansible-playbook.sh
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace DiExamples
{
public class Startup
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace DiExamples
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
@VladislavMS
VladislavMS / WebFormsBootstrapValidation.aspx
Created July 1, 2019 10:03 — forked from meziantou/WebFormsBootstrapValidation.aspx
ASP.NET WebForms Validators & Bootstrap
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ASP.NET WebForms Validators & Bootstrap</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css" />