summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2023-10-07 23:57:05 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2023-10-07 23:57:05 +0200
commit6967e11d9c14554300e07fd70a6a93ffe224f8d3 (patch)
tree2ceccdcb088fe30851245ef47c25ccdb5fbdd8e1
parent7ee547e760db3e776ab7ecd676ed4b8afca0f04b (diff)
downloadinfra-6967e11d9c14554300e07fd70a6a93ffe224f8d3.tar.gz
infra-6967e11d9c14554300e07fd70a6a93ffe224f8d3.tar.bz2
infra-6967e11d9c14554300e07fd70a6a93ffe224f8d3.tar.xz
infra-6967e11d9c14554300e07fd70a6a93ffe224f8d3.zip
bin/ansible: Using ansible from requirements.txt
-rw-r--r--ansible/requirements.txt2
l---------bin/ansible1
l---------bin/ansible-community1
l---------bin/ansible-galaxy1
l---------bin/ansible-inventory1
l---------bin/ansible-playbook1
l---------bin/ansible-vault1
-rwxr-xr-xbin/python-tool29
-rw-r--r--bin/requirements.txt1
9 files changed, 36 insertions, 2 deletions
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