diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2023-10-07 23:57:05 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2023-10-07 23:57:05 +0200 |
commit | 6967e11d9c14554300e07fd70a6a93ffe224f8d3 (patch) | |
tree | 2ceccdcb088fe30851245ef47c25ccdb5fbdd8e1 | |
parent | 7ee547e760db3e776ab7ecd676ed4b8afca0f04b (diff) | |
download | infra-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.txt | 2 | ||||
l--------- | bin/ansible | 1 | ||||
l--------- | bin/ansible-community | 1 | ||||
l--------- | bin/ansible-galaxy | 1 | ||||
l--------- | bin/ansible-inventory | 1 | ||||
l--------- | bin/ansible-playbook | 1 | ||||
l--------- | bin/ansible-vault | 1 | ||||
-rwxr-xr-x | bin/python-tool | 29 | ||||
-rw-r--r-- | bin/requirements.txt | 1 |
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 |