-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ansible): add fedora boilerplates
- Loading branch information
Showing
6 changed files
with
134 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# MKDEVENV 0.1.0 (x-release-please-version) | ||
FROM docker.io/fedora:latest | ||
|
||
ARG USERNAME=mkdevenv | ||
|
||
LABEL mkdevenv.name="ansible-fedora" \ | ||
mkdevenv.summary="Image with general tools for developing Ansible-related projects" \ | ||
mkdevenv.usage="For more information, see <https://github.com/ttybitnik/mkdevenv>" | ||
|
||
COPY .mkdevenv/*.txt /tmp/ | ||
|
||
RUN dnf update -y && xargs -n 1 dnf install -y < /tmp/dnf.txt && dnf clean all \ | ||
&& adduser $USERNAME \ | ||
&& chown $USERNAME:$USERNAME /tmp/*.txt | ||
|
||
WORKDIR /home/$USERNAME/workspace | ||
|
||
USER $USERNAME | ||
|
||
ENV NPM_CONFIG_PREFIX="/home/$USERNAME/.local" | ||
|
||
RUN pip3 install --no-cache-dir -r /tmp/pip.txt | ||
RUN xargs -n 1 npm install -g < /tmp/npm.txt && npm cache clean --force | ||
|
||
CMD ["/bin/bash", "-l"] |
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# MKDEVENV 0.1.0 (x-release-please-version) | ||
# See <https://github.com/ttybitnik/mkdevenv> for more information. | ||
|
||
PROJECT_NAME = changeme | ||
CONTAINER_ENGINE = changeme | ||
|
||
__USER = $(or $(USER),$(shell whoami)) | ||
|
||
# Host targets/commands | ||
.PHONY: devenv start stop clean serestore | ||
|
||
devenv: | ||
$(info Building development container image...) | ||
|
||
$(CONTAINER_ENGINE) build \ | ||
--build-arg USERNAME=$(__USER) \ | ||
-f .mkdevenv/Containerfile \ | ||
-t localhost/mkdevenv/$(PROJECT_NAME) \ | ||
. | ||
|
||
start: | ||
$(info Starting development container...) | ||
|
||
$(CONTAINER_ENGINE) run -it -d --replace \ | ||
$(if $(filter podman,$(CONTAINER_ENGINE)),--userns=keep-id) \ | ||
--name mkdevenv-$(PROJECT_NAME) \ | ||
--volume .:/home/$(__USER)/workspace:Z \ | ||
localhost/mkdevenv/$(PROJECT_NAME):latest | ||
|
||
@# $(CONTAINER_ENGINE) compose .mkdevenv/compose.yaml up -d | ||
|
||
stop: | ||
$(info Stopping development container...) | ||
|
||
$(CONTAINER_ENGINE) stop mkdevenv-$(PROJECT_NAME) | ||
|
||
@# $(CONTAINER_ENGINE) compose .mkdevenv/compose.yaml down | ||
|
||
clean: distclean | ||
$(info Removing development container and image...) | ||
|
||
-$(CONTAINER_ENGINE) rm mkdevenv-$(PROJECT_NAME) | ||
-$(CONTAINER_ENGINE) image rm localhost/mkdevenv/$(PROJECT_NAME) | ||
|
||
@# $(CONTAINER_ENGINE) image prune | ||
|
||
serestore: | ||
$(info Restoring project SELinux context and permissions...) | ||
|
||
chcon -Rv unconfined_u:object_r:user_home_t:s0 . | ||
# find . -type d -exec chmod 700 {} \; | ||
# find . -type f -exec chmod 600 {} \; | ||
|
||
# Container targets/commands | ||
.PHONY: lint test build run deploy debug distclean | ||
|
||
lint: | ||
$(info Running linters...) | ||
|
||
yamllint . | ||
ansible-lint | ||
ansible-playbook --syntax-check *yaml | ||
|
||
test: lint | ||
$(info Running tests...) | ||
|
||
build: test | ||
$(info Building...) | ||
|
||
run: build | ||
$(info Running...) | ||
|
||
deploy: build | ||
$(info Deploying...) | ||
|
||
debug: test | ||
$(info Debugging tasks...) | ||
|
||
distclean: | ||
$(info Cleaning artifacts...) |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# ansible-fedora | ||
|
||
| dnf | npm | pip | | ||
|:-------------|:---------------------------------|:-------------| | ||
| git | yaml-language-server | yamllint | | ||
| make | @ansible/ansible-language-server | ansible-lint | | ||
| ripgrep | | molecule | | ||
| npm | | | | ||
| python3 | | | | ||
| python3-pip | | | | ||
| ansible-core | | | | ||
|
||
1. Create a `.mkdevenv` directory at the root of the project. | ||
2. Copy all the boilerplate files into the `.mkdevenv` directory. | ||
3. Move the `Makefile` to the root of the project. | ||
|
||
*For more information, see <https://github.com/ttybitnik/mkdevenv>.* |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
git | ||
make | ||
ripgrep | ||
npm | ||
python3 | ||
python3-pip | ||
ansible-core |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
yaml-language-server | ||
@ansible/ansible-language-server |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
yamllint | ||
ansible-lint | ||
molecule |