From 6967e11d9c14554300e07fd70a6a93ffe224f8d3 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 7 Oct 2023 23:57:05 +0200 Subject: bin/ansible: Using ansible from requirements.txt --- ansible/requirements.txt | 2 -- bin/ansible | 1 + bin/ansible-community | 1 + bin/ansible-galaxy | 1 + bin/ansible-inventory | 1 + bin/ansible-playbook | 1 + bin/ansible-vault | 1 + bin/python-tool | 29 +++++++++++++++++++++++++++++ bin/requirements.txt | 1 + 9 files changed, 36 insertions(+), 2 deletions(-) delete mode 100644 ansible/requirements.txt create mode 120000 bin/ansible create mode 120000 bin/ansible-community create mode 120000 bin/ansible-galaxy create mode 120000 bin/ansible-inventory create mode 120000 bin/ansible-playbook create mode 120000 bin/ansible-vault create mode 100755 bin/python-tool create mode 100644 bin/requirements.txt diff --git a/ansible/requirements.txt b/ansible/requirements.txt deleted file mode 100644 index f8729dd..0000000 --- a/ansible/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -mitogen==0.3.0rc1 -pyyaml==5.3.1 diff --git a/bin/ansible b/bin/ansible new file mode 120000 index 0000000..42ff5d8 --- /dev/null +++ b/bin/ansible @@ -0,0 +1 @@ +python-tool \ No newline at end of file diff --git a/bin/ansible-community b/bin/ansible-community new file mode 120000 index 0000000..42ff5d8 --- /dev/null +++ b/bin/ansible-community @@ -0,0 +1 @@ +python-tool \ No newline at end of file diff --git a/bin/ansible-galaxy b/bin/ansible-galaxy new file mode 120000 index 0000000..42ff5d8 --- /dev/null +++ b/bin/ansible-galaxy @@ -0,0 +1 @@ +python-tool \ No newline at end of file diff --git a/bin/ansible-inventory b/bin/ansible-inventory new file mode 120000 index 0000000..42ff5d8 --- /dev/null +++ b/bin/ansible-inventory @@ -0,0 +1 @@ +python-tool \ No newline at end of file diff --git a/bin/ansible-playbook b/bin/ansible-playbook new file mode 120000 index 0000000..42ff5d8 --- /dev/null +++ b/bin/ansible-playbook @@ -0,0 +1 @@ +python-tool \ No newline at end of file diff --git a/bin/ansible-vault b/bin/ansible-vault new file mode 120000 index 0000000..42ff5d8 --- /dev/null +++ b/bin/ansible-vault @@ -0,0 +1 @@ +python-tool \ No newline at end of file diff --git a/bin/python-tool b/bin/python-tool new file mode 100755 index 0000000..27cab43 --- /dev/null +++ b/bin/python-tool @@ -0,0 +1,29 @@ +#!/bin/bash + +set -euo pipefail + +basedir="${0%/*}" +self="${0##*/}" +cmd="$basedir/env/bin/$self" + +if [[ ! -x $cmd ]] +then + if [[ ! -d $basedir/env ]] + then + virtualenv --python=python3 $basedir/env + fi + + if [[ ! -e $basedir/env/.cookie || $basedir/requirements.txt -nt $basedir/env/.cookie ]] + then + $basedir/env/bin/pip install -r $basedir/requirements.txt + touch $basedir/env/.cookie + fi +fi + +if [[ "$self" == "python-tool" ]] +then + echo "$0: Setup complete" + exit 0 +fi + +exec "$cmd" "${@}" diff --git a/bin/requirements.txt b/bin/requirements.txt new file mode 100644 index 0000000..a3669d5 --- /dev/null +++ b/bin/requirements.txt @@ -0,0 +1 @@ +ansible==8.4.0 -- cgit v1.2.3