фикс ошибок линта и молекулы

This commit is contained in:
Sergey Antropoff
2026-04-27 08:40:08 +03:00
parent 91299fcc1b
commit d9bc3c0bad
122 changed files with 3997 additions and 179 deletions

View File

@@ -0,0 +1,20 @@
---
- name: Converge — nfs-server template tests
hosts: all
become: false
gather_facts: false
vars:
nfs_allowed_network: "192.168.1.0/24"
nfs_exports:
- path: "/storage/nfs"
options: "192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)"
- path: "/storage/media"
options: "192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)"
tasks:
- name: Render exports.j2
ansible.builtin.template:
src: "{{ playbook_dir }}/../../templates/exports.j2"
dest: /tmp/nfs-exports
mode: "0644"

View File

@@ -0,0 +1,28 @@
---
driver:
name: docker
platforms:
- name: master01
image: geerlingguy/docker-ubuntu2204-ansible:latest
pre_build_image: true
groups:
- k3s_master
provisioner:
name: ansible
playbooks:
converge: converge.yml
verify: verify.yml
config_options:
defaults:
interpreter_python: auto_silent
verifier:
name: ansible
lint: |
set -e
yamllint .
ansible-lint

View File

@@ -0,0 +1,40 @@
---
- name: Verify — nfs-server templates
hosts: all
become: false
gather_facts: false
tasks:
- name: Read rendered exports
ansible.builtin.slurp:
src: /tmp/nfs-exports
register: exports_raw
- name: Set content fact
ansible.builtin.set_fact:
content: "{{ exports_raw.content | b64decode }}"
- name: Assert first export path is present
ansible.builtin.assert:
that: "'/storage/nfs' in content"
fail_msg: "/storage/nfs не найден в exports"
- name: Assert second export path is present
ansible.builtin.assert:
that: "'/storage/media' in content"
fail_msg: "/storage/media не найден в exports"
- name: Assert network is in export options
ansible.builtin.assert:
that: "'192.168.1.0/24' in content"
fail_msg: "192.168.1.0/24 не найден в exports"
- name: Assert no_root_squash option is set
ansible.builtin.assert:
that: "'no_root_squash' in content"
fail_msg: "no_root_squash не найден в exports"
- name: Assert rw option is set
ansible.builtin.assert:
that: "'rw' in content"
fail_msg: "rw option не найден в exports"