refctor: rework ci to ue ansible-lint and fix molecule
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/notify Pipeline was successful

This commit is contained in:
Robert Kaussow 2024-08-19 16:06:10 +02:00
parent 20e49f2d1c
commit fbe074f417
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
13 changed files with 56 additions and 46 deletions

View File

@ -1,15 +0,0 @@
---
ansible:
custom_modules:
- iptables_raw
- openssl_pkcs12
- proxmox_kvm
- ucr
- corenetworks_dns
- corenetworks_token
rules:
exclude_files:
- "LICENSE*"
- "**/*.md"
- "**/*.ini"

View File

@ -9,11 +9,11 @@ steps:
- name: generate - name: generate
image: quay.io/thegeeklab/ansible-doctor image: quay.io/thegeeklab/ansible-doctor
environment: environment:
ANSIBLE_DOCTOR_EXCLUDE_FILES: molecule/ ANSIBLE_DOCTOR_EXCLUDE_FILES: "['molecule/']"
ANSIBLE_DOCTOR_FORCE_OVERWRITE: "true" ANSIBLE_DOCTOR_RENDERER__FORCE_OVERWRITE: "true"
ANSIBLE_DOCTOR_LOG_LEVEL: INFO ANSIBLE_DOCTOR_LOGGING__LEVEL: info
ANSIBLE_DOCTOR_ROLE_NAME: ${CI_REPO_NAME} ANSIBLE_DOCTOR_ROLE__NAME: ${CI_REPO_NAME}
ANSIBLE_DOCTOR_TEMPLATE: readme ANSIBLE_DOCTOR_TEMPLATE__NAME: readme
- name: format - name: format
image: quay.io/thegeeklab/alpine-tools image: quay.io/thegeeklab/alpine-tools

View File

@ -6,10 +6,10 @@ when:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
steps: steps:
- name: ansible-later - name: ansible-lint
image: quay.io/thegeeklab/ansible-later:4 image: quay.io/thegeeklab/ansible-dev-tools:1
commands: commands:
- ansible-later - ansible-lint
environment: environment:
FORCE_COLOR: "1" FORCE_COLOR: "1"

View File

@ -7,7 +7,7 @@ when:
variables: variables:
- &molecule_base - &molecule_base
image: quay.io/thegeeklab/molecule:6 image: quay.io/thegeeklab/ansible-dev-tools:1
group: molecule group: molecule
environment: environment:
PY_COLORS: "1" PY_COLORS: "1"

20
.yamllint Normal file
View File

@ -0,0 +1,20 @@
---
extends: default
rules:
truthy:
allowed-values: ["True", "False"]
comments:
min-spaces-from-content: 1
comments-indentation: False
line-length: disable
braces:
min-spaces-inside: 0
max-spaces-inside: 1
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
indentation: enable
octal-values:
forbid-implicit-octal: True
forbid-explicit-octal: True

View File

@ -22,6 +22,3 @@ galaxy_info:
- relay - relay
- mail - mail
dependencies: [] dependencies: []
collections:
- xoxys.general
- community.general

View File

@ -4,11 +4,11 @@ driver:
dependency: dependency:
name: galaxy name: galaxy
options: options:
role-file: molecule/requirements.yml role-file: requirements.yml
requirements-file: molecule/requirements.yml requirements-file: requirements.yml
platforms: platforms:
- name: "rocky9-postfix-relay" - name: "rocky9-postfix-relay"
server_type: "CX22" server_type: "cx22"
image: "rocky-9" image: "rocky-9"
provisioner: provisioner:
name: ansible name: ansible

View File

@ -1,4 +0,0 @@
---
collections: []
roles: []

7
requirements.yml Normal file
View File

@ -0,0 +1,7 @@
---
collections:
- name: https://gitea.rknet.org/ansible/xoxys.general
type: git
version: main
roles: []

View File

@ -24,6 +24,7 @@
- name: Create sasl_passwd.db - name: Create sasl_passwd.db
ansible.builtin.command: /usr/sbin/postmap hash:/etc/postfix/sasl_passwd ansible.builtin.command: /usr/sbin/postmap hash:/etc/postfix/sasl_passwd
changed_when: False
when: not __sasldb.stat.exists or __sasl_result.changed when: not __sasldb.stat.exists or __sasl_result.changed
notify: __postfix_restart notify: __postfix_restart
@ -51,5 +52,6 @@
- name: Hash sender_canoncial - name: Hash sender_canoncial
ansible.builtin.command: "/usr/sbin/postmap hash:/etc/postfix/sender_canonical" ansible.builtin.command: "/usr/sbin/postmap hash:/etc/postfix/sender_canonical"
changed_when: False
when: not __senderdb.stat.exists or __sender_result.changed when: not __senderdb.stat.exists or __sender_result.changed
notify: __postfix_restart notify: __postfix_restart

View File

@ -1,6 +1,6 @@
--- ---
- name: Set postfix settings to registry - name: Set postfix settings to registry
ucr: xoxys.general.ucr:
path: "{{ item.path }}" path: "{{ item.path }}"
value: "{{ item.value }}" value: "{{ item.value }}"
state: "{{ item.state | default('present') }}" state: "{{ item.state | default('present') }}"
@ -22,6 +22,7 @@
- name: Create smtp_auth.db - name: Create smtp_auth.db
ansible.builtin.command: /usr/sbin/postmap hash:/etc/postfix/smtp_auth ansible.builtin.command: /usr/sbin/postmap hash:/etc/postfix/smtp_auth
changed_when: False
when: not __authdb.stat.exists or __auth_result.changed when: not __authdb.stat.exists or __auth_result.changed
notify: __postfix_restart notify: __postfix_restart

View File

@ -1,5 +1,6 @@
--- ---
- ansible.builtin.include_vars: "{{ var_files }}" - name: Include OS specific vars
ansible.builtin.include_vars: "{{ var_files }}"
vars: vars:
var_files: "{{ lookup('first_found', params, errors='ignore') }}" var_files: "{{ lookup('first_found', params, errors='ignore') }}"
params: params:
@ -10,8 +11,10 @@
paths: paths:
- "vars" - "vars"
when: var_files when: var_files
- ansible.builtin.include_tasks: install.yml - name: Install postfix
- ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}" ansible.builtin.include_tasks: install.yml
- name: Configure postfix
ansible.builtin.include_tasks: "{{ lookup('first_found', params) }}"
vars: vars:
params: params:
files: files:
@ -20,4 +23,10 @@
- "config_default.yml" - "config_default.yml"
paths: paths:
- "tasks" - "tasks"
- ansible.builtin.include_tasks: post_tasks.yml
- name: Ensure postfix service is up and running
ansible.builtin.service:
name: "postfix"
state: started
daemon_reload: True
enabled: True

View File

@ -1,7 +0,0 @@
---
- name: Ensure postfix service is up and running
ansible.builtin.service:
name: "postfix"
state: started
daemon_reload: yes
enabled: yes