feat: add more stuff

This commit is contained in:
Simon Cornet 2026-02-18 17:20:00 +01:00
commit 4e2886dd59
12 changed files with 74 additions and 62 deletions

10
.gitignore vendored
View file

@ -1,9 +1 @@
.ansible/ .ansible
.git/
*.pyc
*.pyo
.molecule/
.tox/
*.log
.venv/
venv/

View file

@ -1,26 +1,13 @@
--- ---
# gitlab stages
stages: stages:
- lint - "gitleaks"
- test - "linting"
variables: # include components
ANSIBLE_FORCE_COLOR: "true" include:
- component: "$CI_SERVER_FQDN/components/ansible/linting@v3.0.3"
ansible-lint: - component: "$CI_SERVER_FQDN/components/gitleaks/gitleaks@v1.0.0"
stage: lint - component: "$CI_SERVER_FQDN/components/markdownlint/markdownlint@1.0.0"
image: "registry.gitlab.com/siempie/ansible-runner:latest" - component: "$CI_SERVER_FQDN/components/yamllint/yamllint@1.0.2"
script:
- "ansible-lint"
rules:
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
- if: "$CI_COMMIT_BRANCH == 'main'"
molecule:
stage: test
image: "registry.gitlab.com/siempie/ansible-runner:latest"
script:
- "molecule test"
rules:
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
- if: "$CI_COMMIT_BRANCH == 'main'"

View file

@ -1,8 +1,12 @@
{ {
// files to lint
"globs": [
"readme.md"
],
// linting rules
"config": { "config": {
"MD004": false, "MD013": {
"MD013": false, "line_length": 120
"MD030": false, }
"MD033": false
} }
} }

View file

@ -1,10 +1,30 @@
--- ---
extends: 'default'
extends: "default"
rules: rules:
line-length: braces:
max: 120 max-spaces-inside: 1
level: "warning" forbid: true
comments:
min-spaces-from-content: 1
comments-indentation: false
empty-lines:
max: 2
indentation: indentation:
spaces: 2 spaces: 2
check-multi-line-strings: true
line-length:
max: 120
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: true
new-line-at-end-of-file: 'enable'
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
truthy:
allowed-values:
- 'true'
- 'false'
quoted-strings:
quote-type: 'any'
required: true

View file

@ -2,7 +2,9 @@
galaxy_info: galaxy_info:
author: "siempie" author: "siempie"
description: "install and configure phpipam" description: "install phpipam"
license: "MIT" license: "MIT"
role_name: "phpipam" role_name: "phpipam"
dependencies: [] dependencies:
- role: "docker"
- role: "traefik"

View file

@ -1,9 +1,12 @@
--- ---
# install phpipam
- name: "install phpipam" - name: "install phpipam"
hosts: "all" hosts: "all"
become: true become: true
tasks: tasks:
# due to semaphore bug we need to do this ourselves
- name: "force-update requirements" - name: "force-update requirements"
ansible.builtin.command: ansible.builtin.command:
cmd: "ansible-galaxy install -f -r roles/requirements.yml" cmd: "ansible-galaxy install -f -r roles/requirements.yml"
@ -12,6 +15,7 @@
changed_when: false changed_when: false
failed_when: false failed_when: false
# execute the role
- name: "execute role: phpipam" - name: "execute role: phpipam"
ansible.builtin.include_role: ansible.builtin.include_role:
name: "phpipam" name: "phpipam"

View file

@ -1,12 +1,4 @@
{ {
"extends": [ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"config:base" "extends": [ "local>cicd/renovate:ansible" ]
],
"packageRules": [
{
"matchPackagePatterns": ["*"],
"matchUpdateTypes": ["patch", "minor", "major"],
"groupName": "all"
}
]
} }

View file

@ -5,7 +5,7 @@ roles:
src: "https://gitlab.simoncor.net/ansible/ans-docker.git" src: "https://gitlab.simoncor.net/ansible/ans-docker.git"
scm: "git" scm: "git"
- name: "phpipam" - name: "phpipam"
src: "https://gitlab.simoncor.net/ansible/ans-ipam.git" src: "https://gitlab.simoncor.net/ansible/ans-phpipam.git"
scm: "git" scm: "git"
- name: "traefik" - name: "traefik"
src: "https://gitlab.simoncor.net/ansible/ans-traefik.git" src: "https://gitlab.simoncor.net/ansible/ans-traefik.git"

View file

@ -1,10 +1,17 @@
--- ---
# create network
- name: "create network"
ansible.builtin.import_tasks: "network.yaml"
# install mariadb
- name: "install mariadb" - name: "install mariadb"
ansible.builtin.import_tasks: "mariadb.yaml" ansible.builtin.import_tasks: "mariadb.yaml"
# install phpipam
- name: "install phpipam" - name: "install phpipam"
ansible.builtin.import_tasks: "phpipam.yaml" ansible.builtin.import_tasks: "phpipam.yaml"
# cleanup docker
- name: "cleanup docker" - name: "cleanup docker"
ansible.builtin.import_tasks: "cleanup.yaml" ansible.builtin.import_tasks: "cleanup.yaml"

View file

@ -32,12 +32,13 @@
tty: "no" tty: "no"
# run mariadb # run mariadb
name: "ipam-db" name: "phpipam-db"
image: "docker.io/mariadb:lts" image: "docker.io/mariadb:lts"
image_name_mismatch: "recreate" image_name_mismatch: "recreate"
restart_policy: "unless-stopped" restart_policy: "unless-stopped"
networks: networks:
- name: "ipam-network" - name: "phpipam"
volumes: volumes:
- "/mnt/ipam/mysql:/var/lib/mysql" - "/mnt/ipam/mysql:/var/lib/mysql"

9
tasks/network.yaml Normal file
View file

@ -0,0 +1,9 @@
---
# create network
- name: "docker - create phpipam network"
community.docker.docker_network:
name: "phpipam"
driver: "bridge"
state: "present"

View file

@ -8,12 +8,6 @@
group: "root" group: "root"
mode: "0775" mode: "0775"
- name: "create ipam network"
community.docker.docker_network:
name: "ipam-network"
driver: "bridge"
state: "present"
- name: "run phpipam" - name: "run phpipam"
community.docker.docker_container: community.docker.docker_container: