-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
playbook ?= playbooks/main | ||
env ?= environments/prod | ||
.venv: | ||
virtualenv .venv | ||
.venv/bin/pip3 install poetry | ||
|
||
.PHONY: prereq | ||
prereq: ## Install any pre-req roles and collections | ||
ansible-galaxy collection install -r collections/requirements.yml | ||
ansible-galaxy role install -r roles/requirements.yml | ||
PHONY: prereqs | ||
prereqs: .venv | ||
.venv/bin/python3 -m poetry install --no-root | ||
.venv/bin/python3 -m poetry run ansible-galaxy install -r requirements.yml | ||
|
||
.PHONY: deploy | ||
deploy: ## Run the main.yaml playbook against the inventory | ||
@env=$(env) ansible-playbook --inventory-file="$(env)" --diff "$(playbook).yaml" $(ARGS) | ||
PHONY: lint | ||
lint: prereqs | ||
.venv/bin/python3 -m poetry run ansible-lint | ||
|
||
.PHONY: ping | ||
ping: ## Ping all hosts in the inventory file | ||
@env=$(env) ansible -i $(env) -m ping all | ||
|
||
.PHONY: lint | ||
lint: ## lint the ansible playbooks | ||
ansible-lint | ||
|
||
.PHONY: build-container | ||
build-container: ## Build the docker container version of the playbook | ||
docker build . | ||
PHONY: deploy | ||
deploy: prereqs | ||
.venv/bin/python3 -m poetry run ansible-playbook -i environments/prod playbooks/main.yaml --vault-password-file .pass --diff --check $(extra_args) |