Complete rewrite role logic

This commit is contained in:
York-Simon Johannsen
2021-11-28 05:10:17 +01:00
parent 4bfbc9908b
commit 2a465d869c
5 changed files with 163 additions and 69 deletions
+12
View File
@@ -0,0 +1,12 @@
# Markdownlint config file
##
## Repo
## https://github.com/DavidAnson/markdownlint
## Rules
## https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
## Example config
## https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
MD013:
line_length: 160
default: true
+101
View File
@@ -0,0 +1,101 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-json
- id: check-shebang-scripts-are-executable
- id: check-xml
- id: check-yaml
- id: detect-private-key
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: mixed-line-ending
- id: pretty-format-json
args:
- --autofix
- id: trailing-whitespace
- repo: https://github.com/Lucas-C/pre-commit-hooks-java
rev: 1.3.10
hooks:
- id: validate-html
- repo: https://github.com/Lucas-C/pre-commit-hooks-lxml
rev: v1.1.0
hooks:
- id: forbid-html-img-without-alt-text
- id: forbid-non-std-html-attributes
- id: detect-missing-css-classes
args:
- --css-files-dir
- .
- --html-files-dir
- .
- id: html-tags-blacklist
- id: html-attributes-blacklist
- repo: git://github.com/detailyang/pre-commit-shell
rev: 1.0.5
hooks:
- id: shell-lint
- repo: https://github.com/lovesegfault/beautysh
rev: v6.2.1
hooks:
- id: beautysh
args:
- --indent-size=2
- repo: https://github.com/jorisroovers/gitlint
rev: v0.16.0
hooks:
- id: gitlint
- repo: https://github.com/IamTheFij/ansible-pre-commit
rev: v0.1.2
hooks:
- id: encryption-check
- repo: https://github.com/mattlqx/pre-commit-sign
rev: v1.1.3
hooks:
- id: sign-commit
- repo: https://github.com/ansible-community/ansible-lint
rev: v5.2.1
hooks:
- id: ansible-lint
- repo: https://github.com/Vimjas/vint
rev: v0.4a3
hooks:
- id: vint
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.1
hooks:
- id: shellcheck
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.29.0
hooks:
- id: markdownlint
- repo: https://github.com/zricethezav/gitleaks
rev: v7.6.1
hooks:
- id: gitleaks
- repo: https://gitlab.com/daverona/pre-commit/php
rev: 0.6.0
hooks:
- id: phpmd
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.10
hooks:
- id: mdformat
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.29.0
hooks:
- id: markdownlint
- repo: https://github.com/sqlfluff/sqlfluff
rev: 0.8.1
hooks:
- id: sqlfluff-lint
- repo: https://github.com/sirosen/texthooks
rev: 0.2.0
hooks:
- id: fix-smartquotes
- id: fix-ligatures
+13
View File
@@ -0,0 +1,13 @@
rules:
brackets: false
colons: false
document-start:
present: false
indentation:
spaces: 2
line-length:
max: 160
new-line-at-end-of-file: enable
new-lines:
type: unix
truthy: false
+28 -9
View File
@@ -1,15 +1,34 @@
---
- name: Generate fallback filename
ansible.builtin.set_fact:
apt_deb822_filename_fallback: |-
{{
apt_deb822_filename |
default(
apt_deb822_options.URIs |
first |
regex_replace('([^@]+)$', '\1') |
regex_replace('[^a-zA-Z0-9]+', '_') |
regex_replace('_$', '')
)
}}.sources
when: not apt_deb822_filename is defined
tags:
- repo
- apt_deb822
- name: Deploy deb822 repository file
template:
src: deb822.sources.j2
dest: "/etc/apt/sources.list.d/{{ filename }}.sources"
when: state | default( 'present' ) != "absent"
dest: "/etc/apt/sources.list.d/{{ apt_deb822_filename | default( apt_deb822_filename_fallback ) }}.sources"
when: apt_deb822_state | default( 'present' ) != "absent"
tags:
- repo
- apt_deb822
- name: Remove deb822 repository file
file:
dest: "/etc/apt/sources.list.d/{{ filename }}.sources"
when: state | default( 'present' ) == "absent"
- name: update_cache
apt:
update_cache: "{{ update_cache | default( true ) }}"
dest: "/etc/apt/sources.list.d/{{ apt_deb822_filename | default( apt_deb822_filename_fallback ) }}.sources"
when: apt_deb822_state | default( 'present' ) == "absent"
tags:
- repo
- apt_deb822
+9 -60
View File
@@ -1,60 +1,9 @@
Types: {{ types | join(' ') }}
URIs: {{ uris | join(' ') }}
Suites: {{ suites | join(' ') }}
{% if components is defined %}
Components: {{ components | join(' ') }}
{% endif -%}
{% if description is defined %}
Description: {{ description }}
{% endif -%}
{%- if enabled is defined %}
Enabled: {% if enabled %}yes{%else%}no{% endif %}
{% endif -%}
{%- if architectures is defined %}
Architectures: {{ architectures | join(' ') }}
{% endif -%}
{%- if languages is defined %}
Languages: {{ languages | join(' ') }}
{% endif -%}
{%- if targets is defined %}
Targets: {{ targets | join(' ') }}
{% endif -%}
{%- if pdiffs is defined %}
PDiffs: {% if pdiffs %}yes{%else%}no{% endif %}
{% endif -%}
{%- if hash is defined %}
By-Hash: {% if hash %}yes{%else%}no{% endif %}
{% endif -%}
{% if insecure is defined %}
Allow-Insecure: {% if insecure %}yes{% else %}no{% endif %}
{% endif -%}
{%- if weak is defined %}
Allow-Weak: {% if weak == true %}yes{% else %}no{% endif %}
{% endif -%}
{%- if downgrade is defined %}
Allow-Downgrade-To-Insecure: {% if downgrade %}yes{% else %}no{% endif %}
{% endif -%}
{%- if trusted is defined %}
Trusted: {% if trusted %}yes{% else %}no{% endif %}
{% endif -%}
{%- if signed_by is defined %}
Signed-By: {{ signed_by }}
{% endif -%}
{%- if valid_valid_until is defined %}
Check-Valid-Until: {% if valid_valid_until %}yes{% else %}no{% endif %}
{% endif -%}
{%- if valid_until_min is defined %}
Valid-Until-Min: {{ valid_until_min }}
{% endif -%}
{%- if valid_until_max is defined %}
Valid-Until-Max: {{ valid_until_max }}
{% endif -%}
{%- if check_date is defined %}
Check-Date: {% if check_date %}yes{% else %}no{% endif %}
{% endif -%}
{%- if date_max_future is defined %}
Date-Max-Future: {{ date_max_future }}
{% endif -%}
{%- if in_release_path is defined %}
InRelease-Path: {{ in_release_path }}
{% endif -%}
# {{ ansible_managed }}
{% for key, value in apt_deb822_options.items() %}
{{ key }}: {%- if value is boolean %}
{{ 'Yes' if value else 'No' -}}
{% elif value is iterable and (var is not string and var is not mapping) %}
{{ value | join(' ') -}}
{% endif +%}
{% endfor %}