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