diff --git a/.gitignore b/.gitignore index 56a988f..904cae8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1 @@ -.ansible/ -.git/ -*.pyc -*.pyo -.molecule/ -.tox/ -*.log -.venv/ -venv/ +.ansible diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 290c01e..7ec2c37 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,13 @@ --- +# gitlab stages stages: - - lint - - test + - "gitleaks" + - "linting" -variables: - ANSIBLE_FORCE_COLOR: "true" - -ansible-lint: - stage: lint - image: "registry.gitlab.com/siempie/ansible-runner:latest" - 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'" +# include components +include: + - component: "$CI_SERVER_FQDN/components/ansible/linting@v3.0.3" + - component: "$CI_SERVER_FQDN/components/gitleaks/gitleaks@v1.0.0" + - component: "$CI_SERVER_FQDN/components/markdownlint/markdownlint@1.0.0" + - component: "$CI_SERVER_FQDN/components/yamllint/yamllint@1.0.2" diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc index 621d874..56cd87c 100644 --- a/.markdownlint-cli2.jsonc +++ b/.markdownlint-cli2.jsonc @@ -1,8 +1,12 @@ { + // files to lint + "globs": [ + "readme.md" + ], + // linting rules "config": { - "MD004": false, - "MD013": false, - "MD030": false, - "MD033": false + "MD013": { + "line_length": 120 + } } } diff --git a/.yamllint b/.yamllint index e23a6f5..f11bd84 100644 --- a/.yamllint +++ b/.yamllint @@ -1,10 +1,30 @@ --- - -extends: "default" +extends: 'default' rules: - line-length: - max: 120 - level: "warning" + braces: + max-spaces-inside: 1 + forbid: true + comments: + min-spaces-from-content: 1 + comments-indentation: false + empty-lines: + max: 2 indentation: 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 diff --git a/meta/main.yaml b/meta/main.yaml index 8581622..0589657 100644 --- a/meta/main.yaml +++ b/meta/main.yaml @@ -2,7 +2,9 @@ galaxy_info: author: "siempie" - description: "install and configure phpipam" + description: "install phpipam" license: "MIT" role_name: "phpipam" -dependencies: [] +dependencies: + - role: "docker" + - role: "traefik" diff --git a/playbook.yaml b/playbook.yaml index 35f8630..c11c432 100644 --- a/playbook.yaml +++ b/playbook.yaml @@ -1,9 +1,12 @@ --- +# install phpipam - name: "install phpipam" hosts: "all" become: true tasks: + + # due to semaphore bug we need to do this ourselves - name: "force-update requirements" ansible.builtin.command: cmd: "ansible-galaxy install -f -r roles/requirements.yml" @@ -12,6 +15,7 @@ changed_when: false failed_when: false + # execute the role - name: "execute role: phpipam" ansible.builtin.include_role: name: "phpipam" diff --git a/renovate.json b/renovate.json index d02a70e..91260cb 100644 --- a/renovate.json +++ b/renovate.json @@ -1,12 +1,4 @@ { - "extends": [ - "config:base" - ], - "packageRules": [ - { - "matchPackagePatterns": ["*"], - "matchUpdateTypes": ["patch", "minor", "major"], - "groupName": "all" - } - ] + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ "local>cicd/renovate:ansible" ] } diff --git a/roles/requirements.yml b/roles/requirements.yml index ef2f200..a1a6787 100644 --- a/roles/requirements.yml +++ b/roles/requirements.yml @@ -5,7 +5,7 @@ roles: src: "https://gitlab.simoncor.net/ansible/ans-docker.git" scm: "git" - name: "phpipam" - src: "https://gitlab.simoncor.net/ansible/ans-ipam.git" + src: "https://gitlab.simoncor.net/ansible/ans-phpipam.git" scm: "git" - name: "traefik" src: "https://gitlab.simoncor.net/ansible/ans-traefik.git" diff --git a/tasks/main.yaml b/tasks/main.yaml index 60662ad..be805d4 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -1,10 +1,17 @@ --- +# create network +- name: "create network" + ansible.builtin.import_tasks: "network.yaml" + +# install mariadb - name: "install mariadb" ansible.builtin.import_tasks: "mariadb.yaml" +# install phpipam - name: "install phpipam" ansible.builtin.import_tasks: "phpipam.yaml" +# cleanup docker - name: "cleanup docker" ansible.builtin.import_tasks: "cleanup.yaml" diff --git a/tasks/mariadb.yaml b/tasks/mariadb.yaml index b007ee7..3544d15 100644 --- a/tasks/mariadb.yaml +++ b/tasks/mariadb.yaml @@ -32,12 +32,13 @@ tty: "no" # run mariadb - name: "ipam-db" + name: "phpipam-db" image: "docker.io/mariadb:lts" image_name_mismatch: "recreate" restart_policy: "unless-stopped" networks: - - name: "ipam-network" + - name: "phpipam" + volumes: - "/mnt/ipam/mysql:/var/lib/mysql" diff --git a/tasks/network.yaml b/tasks/network.yaml new file mode 100644 index 0000000..3666f30 --- /dev/null +++ b/tasks/network.yaml @@ -0,0 +1,9 @@ +--- + +# create network +- name: "docker - create phpipam network" + community.docker.docker_network: + name: "phpipam" + driver: "bridge" + state: "present" + diff --git a/tasks/phpipam.yaml b/tasks/phpipam.yaml index bde7102..c997e02 100644 --- a/tasks/phpipam.yaml +++ b/tasks/phpipam.yaml @@ -8,12 +8,6 @@ group: "root" mode: "0775" -- name: "create ipam network" - community.docker.docker_network: - name: "ipam-network" - driver: "bridge" - state: "present" - - name: "run phpipam" community.docker.docker_container: