Closed jpmens closed 9 months ago
Handle "restart services" on ubuntu after apt install python3-pip
apt install python3-pip python3.10-venv
useradd --home-dir /usr/local/owntracks/ansible --create-home --comment Ansible --system ansible
sudo -u ansible python3 -mvenv /usr/local/owntracks/ansible
sudo -u ansible /usr/local/owntracks/ansible/bin/pip install ansible-core
sudo -u ansible /usr/local/owntracks/ansible/bin/ansible-galaxy collection install community.general
sudo -u ansible /usr/local/owntracks/ansible/bin/ansible-galaxy collection install community.crypto
Looks good, but installing c.general collection takes ages on first run. Or does it?
and if I install ansible full?
time sudo -u ansible /usr/local/owntracks/ansible/bin/pip install ansible
real 1m1.490s
user 0m0.006s
sys 0m0.013s
du -sh /usr/local/owntracks/ansible/
626M /usr/local/owntracks/ansible/
diff --git a/bootstrap.sh b/bootstrap.sh
index 717d4af..fa8893a 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -8,9 +8,10 @@ fi
if ! which ansible-playbook > /dev/null; then
echo "Attempting to install ansible for bootstrapping"
sudo apt update
- sudo apt -qq install -y ansible
+ sudo NEEDRESTART_MODE=a apt install python3-pip
fi
+
# people who know Ansible might be questioning some of the practices
# here such as why not use ansible.cfg right here, or templates in
# templates/ directory; the intention is to hide as much of the
@@ -18,4 +19,4 @@ fi
export ANSIBLE_CONFIG=files/ansible/ansible.cfg
-ansible-playbook owntracks-setup.yml "$@"
+/usr/local/owntracks/ansible/bin/ansible-playbook owntracks-setup.yml "$@"
diff --git a/files/ansible/ansible.cfg b/files/ansible/ansible.cfg
index 01193e9..f5a091a 100644
--- a/files/ansible/ansible.cfg
+++ b/files/ansible/ansible.cfg
@@ -3,3 +3,5 @@ nocows=1
inventory=inventory.ini
filter_plugins = filter_plugins/
jinja2_native = False
+collections_path = /usr/local/owntracks/ansible/.ansible/collections/ansible_collections
Tested on a fresh Debian 12 as well.
Instead of installing via packages, we should install via
pip
(to user). Installingansible-core
and the two required collections is likely faster and will consume less space.The advantage for us is pinning the release we want and thus having same versions on Debian and Ubuntu.
Must verify we then have