2020-06-16 10:04:54 -05:00
|
|
|
#! /bin/bash
|
2020-02-14 15:40:31 -06:00
|
|
|
#
|
2020-06-16 10:04:54 -05:00
|
|
|
# localhost-deploy.sh
|
|
|
|
# Deploys configs for local machine and only local machine
|
2020-02-14 15:40:31 -06:00
|
|
|
# Copyright (C) 2020 Vintage Salt <rehashedsalt@cock.li>
|
|
|
|
#
|
|
|
|
# Distributed under terms of the MIT license.
|
|
|
|
#
|
2020-03-23 04:24:18 -05:00
|
|
|
set -e
|
|
|
|
if ! command -v ansible > /dev/null 2>&1; then
|
|
|
|
printf "Installing Ansible and related packages\n"
|
2020-09-02 17:47:03 -05:00
|
|
|
if command -v apt > /dev/null 2>&1; then
|
|
|
|
printf "Installing via APT\n"
|
|
|
|
sudo apt-get install python3-pip python3-setuptools -y
|
2020-09-02 18:03:01 -05:00
|
|
|
elif command -v apk > /dev/null 2>&1; then
|
2020-09-02 17:47:03 -05:00
|
|
|
printf "Installing via APK\n"
|
2020-09-02 22:04:17 -05:00
|
|
|
sudo apk add gcc musl-dev py3-cryptography py3-pip py3-setuptools
|
2020-09-02 18:03:41 -05:00
|
|
|
else
|
|
|
|
printf "No supported package manager found\nPlease install Ansible manually"
|
|
|
|
exit 1
|
2020-09-02 17:47:03 -05:00
|
|
|
fi
|
2020-03-23 04:24:18 -05:00
|
|
|
sudo pip3 install ansible
|
|
|
|
fi
|
2020-06-16 10:08:12 -05:00
|
|
|
ansible-playbook site.yml -l "$HOSTNAME" -e "ansible_user=$USER ansible_connection=local ansible_host=localhost" --ask-become-pass --ask-vault-pass "$@"
|
2020-02-14 15:40:31 -06:00
|
|
|
|