Drop venv completely, use host ansible

This commit is contained in:
2022-07-01 20:03:36 +02:00
parent f219630319
commit 2a58bcadb3
4 changed files with 8 additions and 55 deletions

1
.gitignore vendored
View File

@@ -1,2 +1 @@
/venv/
/*.bundle /*.bundle

View File

@@ -1,26 +1,15 @@
DISTRO := $(shell . /etc/os-release && echo $$NAME)
venv = ./venv
requirements = requirements.txt
activate = . $(venv)/bin/activate
pip = pip
ifeq ($(DISTRO),Ubuntu)
ansible_run = $(activate) && ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS}
else
ansible_run = ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS} ansible_run = ansible-playbook -e ansible_python_interpreter=/usr/bin/python3 --inventory localhost, --diff ./playbook.yml ${ANSIBLE_EXTRA_ARGS}
endif
.PHONY: all .PHONY: all
all: | venv all:
$(ansible_run) $(ansible_run)
.PHONY: config .PHONY: config
config: | venv config:
$(ansible_run) --skip-tags system-update $(ansible_run) --skip-tags system-update
.PHONY: system-update .PHONY: system-update
system-update: venv system-update:
$(ansible_run) --tags system-update $(ansible_run) --tags system-update
.PHONY: reboot .PHONY: reboot
@@ -35,30 +24,13 @@ poweroff:
weekend: | update poweroff weekend: | update poweroff
.PHONY: packages .PHONY: packages
packages: venv packages:
$(ansible_run) --tags packages $(ansible_run) --tags packages
.PHONY: dotfiles .PHONY: dotfiles
dotfiles: venv dotfiles:
$(ansible_run) --tags dotfiles $(ansible_run) --tags dotfiles
.PHONY: clean
clean:
rm -rf venv
.PHONY: test .PHONY: test
test: test:
./test-in-docker.sh ./test-in-docker.sh
ifeq ($(DISTRO), Ubuntux)
venv:
python3 -m venv $(venv)
$(activate) && $(pip) install -r $(requirements)
else
venv:
true
endif
.PHONY: freeze
freeze:
$(activate) && $(pip) freeze > $(requirements)

View File

@@ -77,19 +77,13 @@ if ! command -v make >/dev/null ; then
printf 'Done\n' printf 'Done\n'
fi fi
# Required for compiling modules in venv.
if ! command -v gcc >/dev/null ; then
printf 'gcc not installed, installing ...\n'
_install "gcc"
printf 'Done\n'
fi
if [[ $NAME == "Arch Linux" ]] ; then if [[ $NAME == "Arch Linux" ]] ; then
_install "ansible" _install "ansible"
fi fi
if [[ $NAME == "Ubuntu" ]] ; then if [[ $NAME == "Ubuntu" ]] ; then
_install "python3-venv" _install "ansible"
_install "python3-jmespath"
fi fi
cd "$DOTDIR" && make cd "$DOTDIR" && make

View File

@@ -1,12 +0,0 @@
ansible==4.6.0
ansible-core==2.11.5
cffi==1.14.6
cryptography==35.0.0
Jinja2==3.0.1
jmespath==0.10.0
MarkupSafe==2.0.1
packaging==21.0
pycparser==2.20
pyparsing==2.4.7
PyYAML==5.4.1
resolvelib==0.5.4