Skip to content

Commit

Permalink
Ansible installation
Browse files Browse the repository at this point in the history
  • Loading branch information
eccles committed May 16, 2021
1 parent 3934b0d commit fce5714
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ help: ## Show this help

.PHONY: tools-check
tools-check: ## Check that all tools are available
./scripts/tools-check.sh
@./scripts/tools/check.sh

.PHONY: tools-install
tools-install: ## Install missing tools
./scripts/tools-install.sh
tools-install: ## Ensure that all tools are available
@./scripts/tools/install.sh
43 changes: 43 additions & 0 deletions scripts/tools/ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Installs ansible
#
# This file is sourced
#
. ./scripts/log
. ./scripts/os

ansible_check() {
ANSIBLE=$(which ansible)
if [ $? -ne 0 ]
then
log_warn "Please install ansible"
else
log_info "ansible available at $ANSIBLE"
fi
}

ansible_install() {
ANSIBLE=$(which ansible)
if [ $? -ne 0 ]
then
case $OS_TYPE in
"ubuntu"| "pop")
log_info "Installing ansible on $OS_TYPE"
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
;;
"fedora")
log_info "Installing ansible on $OS_TYPE"
sudo dnf install ansible
;;
*)
log_error "Unknown OS $OS_TYPE"
;;

esac
else
log_info "ansible is already installed at $ANSIBLE"
fi
}
6 changes: 6 additions & 0 deletions scripts/tools/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#
# Checks that all tools are available
. ./scripts/tools/ansible

ansible_check
7 changes: 7 additions & 0 deletions scripts/tools/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
#
# Installs necessary tools
#
. ./scripts/tools/ansible

ansible_install

0 comments on commit fce5714

Please sign in to comment.