fix(makefile): improve makefile

- add TAGS that will allow running specific parts of playbooks
- rename ‹fedora-bootstrap› to ‹bootstrap›, since it's generic
- introduce target for switching fedora repositories
  - with optional REMOTE variable

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-03-13 13:53:15 +01:00
parent 2fdc93bd5e
commit a5e0959ddb
No known key found for this signature in database
GPG key ID: 332171FADF1DB90B

View file

@ -1,24 +1,29 @@
.PHONY: deps fedora-deps fedora-bootstrap fedora-release-upgrade gpg keys .PHONY: deps bootstrap fedora-deps fedora-release-upgrade fedora-switch-repository gpg keys
CONNECTION ?= local CONNECTION ?= local
INVENTORY ?= localhost INVENTORY ?= localhost
TAGS ?= all
ANSIBLE_PYTHON := /usr/bin/python3 ANSIBLE_PYTHON := /usr/bin/python3
AP := ansible-playbook -vv -K -c $(CONNECTION) -i $(INVENTORY), -e ansible_python_interpreter=$(ANSIBLE_PYTHON) AP := ansible-playbook -vv -K -c $(CONNECTION) -i $(INVENTORY), -e ansible_python_interpreter=$(ANSIBLE_PYTHON) --tags $(TAGS) $(AP_ARGS)
deps: deps:
ansible-galaxy collection install community.general ansible-galaxy collection install community.general
bootstrap:
$(AP) playbooks/bootstrap.yml
# Fedora # Fedora
fedora-deps: fedora-deps:
sudo dnf install -y ansible ansible-collection-community-general sudo dnf install -y ansible ansible-collection-community-general
fedora-bootstrap:
$(AP) playbooks/fedora.yml
fedora-release-upgrade: fedora-release-upgrade:
$(AP) playbooks/fedora_upgrade.yml $(AP) playbooks/fedora_upgrade.yml
REMOTE ?= local
fedora-switch-repository:
$(AP) -e source=$(REMOTE) playbooks/fedora_repository.yml
# Scripts # Scripts
gpg: gpg:
bash scripts/generate_gpg.sh bash scripts/generate_gpg.sh
@ -26,5 +31,6 @@ gpg:
keys: keys:
bash scripts/export_keys.sh bash scripts/export_keys.sh
# Catch any other playbook
%.yml: %.yml:
$(AP) $@ $(AP) $@