From e95736280298541aa756d85cc3e5216022cb327a Mon Sep 17 00:00:00 2001 From: RDF Date: Thu, 15 Sep 2022 11:56:49 -0300 Subject: [PATCH] first commit --- .gitmodules | 3 +++ Ansible | 1 + Environments/prod/Host.yml | 0 Environments/prod/Services/Docker.yml | 0 Environments/prod/Services/LXD.yml | 6 +++++ Environments/prod/ansible.config | 0 Environments/prod/requirements.yml | 0 Hooks/pre-commit.j2.bash | 34 +++++++++++++++++++++++++++ init.playbook.yml | 14 +++++++++++ 9 files changed, 58 insertions(+) create mode 100644 .gitmodules create mode 160000 Ansible create mode 100644 Environments/prod/Host.yml create mode 100644 Environments/prod/Services/Docker.yml create mode 100644 Environments/prod/Services/LXD.yml create mode 100644 Environments/prod/ansible.config create mode 100644 Environments/prod/requirements.yml create mode 100644 Hooks/pre-commit.j2.bash create mode 100644 init.playbook.yml diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..08f106d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Ansible"] + path = Ansible + url = https://git.mps.org.uy/MPS/MPS-Ansible.git diff --git a/Ansible b/Ansible new file mode 160000 index 0000000..b380c25 --- /dev/null +++ b/Ansible @@ -0,0 +1 @@ +Subproject commit b380c25fc27f3fc19572a8b4a99050ea30b060fd diff --git a/Environments/prod/Host.yml b/Environments/prod/Host.yml new file mode 100644 index 0000000..e69de29 diff --git a/Environments/prod/Services/Docker.yml b/Environments/prod/Services/Docker.yml new file mode 100644 index 0000000..e69de29 diff --git a/Environments/prod/Services/LXD.yml b/Environments/prod/Services/LXD.yml new file mode 100644 index 0000000..bed3740 --- /dev/null +++ b/Environments/prod/Services/LXD.yml @@ -0,0 +1,6 @@ +ldap: + instance: {} + servicePlaybook: OpenLDAP.yml +Git: + instance: {} + servicePlaybook: GitTea.yml \ No newline at end of file diff --git a/Environments/prod/ansible.config b/Environments/prod/ansible.config new file mode 100644 index 0000000..e69de29 diff --git a/Environments/prod/requirements.yml b/Environments/prod/requirements.yml new file mode 100644 index 0000000..e69de29 diff --git a/Hooks/pre-commit.j2.bash b/Hooks/pre-commit.j2.bash new file mode 100644 index 0000000..0455307 --- /dev/null +++ b/Hooks/pre-commit.j2.bash @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +shopt -s nullglob +declare -a FILES +declare -a HIT + +echo "Git hook executing: pre-commit..." + +# dump staged filenames into FILES array +FILES=(`git diff --cached --name-only --diff-filter=ACM`) + +n=0 +for i in "${FILES[@]}"; do + WARN=`file --mime "${i}" | grep -i binary` + NAME=`file "${i}" | cut -d":" -f1` + + if [ -n "${WARN}" ]; then + HIT[$n]="${NAME}" + WARN="" + echo "${NAME} appears to be a binary blob." + exit 1 + elif [[ "${NAME}" == *"blah" ]]; then + true + # do some stuff here + else + true + # do some other stuff here + fi + let "n++" +done + +if [ ${#HIT[@]} -gt 0 ]; then + echo " WARNING: Binary data found" +fi \ No newline at end of file diff --git a/init.playbook.yml b/init.playbook.yml new file mode 100644 index 0000000..876a8d1 --- /dev/null +++ b/init.playbook.yml @@ -0,0 +1,14 @@ +--- +# On localhost + +- hosts: localhost + tasks: + - shell: "git submodule init" + - shell: "git submodule update --remote --merge" + - with_fileglob: Hooks/*.j2.* + ansible.builtin.copy: + src: "{{item}}" + dest: ".git/hooks/{{ item | split('/') | last | split('.') | first }}" + + # Init submodules + # Install Githooks \ No newline at end of file