-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
47 lines (31 loc) · 1.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
SHELL := $(shell which bash)
SELF := $(patsubst %/,%,$(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
POETRY_BIN ?= $(shell command -v poetry)
POETRY_RUN := $(if $(POETRY_BIN),$(POETRY_BIN) run,)
I ?= $(SELF)/inventory/example.yml
INVENTORY ?= $(I)
T ?=
TAGS ?= $(T)
S ?=
SKIP_TAGS ?= $(S)
V ?= vv
VERBOSE ?= $(V)
export
# Make sure we source ANSIBLE_ settings from ansible.cfg exclusively.
unexport $(filter ANSIBLE_%,$(.VARIABLES))
.PHONY: all
all: main
.PHONY: infra pre ceph site main
infra pre ceph site main: _TAGS := $(if $(TAGS),-t $(TAGS),)
infra pre ceph site main: _SKIP_TAGS := $(if $(SKIP_TAGS),--skip-tags $(SKIP_TAGS),)
infra pre ceph site main: _VERBOSE := $(if $(VERBOSE),-$(VERBOSE),)
infra pre ceph site main:
cd $(SELF)/ && $(POETRY_RUN) ansible-playbook $(_VERBOSE) -i $(INVENTORY) $(_TAGS) $(_SKIP_TAGS) opennebula.deploy.$@
.PHONY: requirements requirements-poetry requirements-python requirements-galaxy
requirements: requirements-$(if $(POETRY_RUN),poetry,python) requirements-galaxy
requirements-poetry: $(SELF)/pyproject.toml
poetry update --directory $(dir $<)
requirements-python: $(SELF)/requirements.txt
pip3 install --requirement $<
requirements-galaxy: $(SELF)/requirements.yml
$(POETRY_RUN) ansible-galaxy collection install --requirements-file $<