refctor: rework ci to ue ansible-lint and fix molecule
This commit is contained in:
parent
4e46955702
commit
f2c009b42d
15
.later.yml
15
.later.yml
@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
ansible:
|
|
||||||
custom_modules:
|
|
||||||
- iptables_raw
|
|
||||||
- openssl_pkcs12
|
|
||||||
- proxmox_kvm
|
|
||||||
- ucr
|
|
||||||
- corenetworks_dns
|
|
||||||
- corenetworks_token
|
|
||||||
|
|
||||||
rules:
|
|
||||||
exclude_files:
|
|
||||||
- "LICENSE*"
|
|
||||||
- "**/*.md"
|
|
||||||
- "**/*.ini"
|
|
@ -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
|
||||||
|
@ -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"
|
||||||
|
|
||||||
|
@ -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
20
.yamllint
Normal 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
|
@ -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-woodpecker-agent"
|
- name: "rocky9-woodpecker-agent"
|
||||||
server_type: "CX22"
|
server_type: "cx22"
|
||||||
image: "rocky-9"
|
image: "rocky-9"
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
collections: []
|
|
||||||
|
|
||||||
roles: []
|
|
6
requirements.yml
Normal file
6
requirements.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
collections:
|
||||||
|
- name: community.general
|
||||||
|
- name: ansible.posix
|
||||||
|
|
||||||
|
roles: []
|
28
tasks/create.yml
Normal file
28
tasks/create.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
- name: Create swap file
|
||||||
|
ansible.builtin.command: "fallocate -l {{ swap_size }}M {{ swap_path }}"
|
||||||
|
changed_when: False
|
||||||
|
when: swap_size | int > (ansible_swaptotal_mb | int) + 1
|
||||||
|
|
||||||
|
- name: Format swap file
|
||||||
|
ansible.builtin.command: "mkswap {{ swap_path }}"
|
||||||
|
changed_when: False
|
||||||
|
when: swap_size | int > (ansible_swaptotal_mb | int) + 1
|
||||||
|
|
||||||
|
- name: Fix file permissions
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ swap_path }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0600"
|
||||||
|
|
||||||
|
- name: Mount swap file
|
||||||
|
ansible.posix.mount:
|
||||||
|
src: "{{ swap_path }}"
|
||||||
|
path: none
|
||||||
|
fstype: swap
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Enable swap
|
||||||
|
ansible.builtin.command: "swapon -a"
|
||||||
|
changed_when: False
|
16
tasks/delete.yml
Normal file
16
tasks/delete.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- name: Disable swap
|
||||||
|
ansible.builtin.shell: "test -f {{ swap_path }} && swapoff {{ swap_path }} || true"
|
||||||
|
changed_when: False
|
||||||
|
|
||||||
|
- name: Unmount swap file
|
||||||
|
ansible.posix.mount:
|
||||||
|
src: "{{ swap_path }}"
|
||||||
|
path: none
|
||||||
|
fstype: swap
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Remove swap file
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ swap_path }}"
|
||||||
|
state: absent
|
@ -1,48 +1,8 @@
|
|||||||
---
|
---
|
||||||
- when: not (swap_enabled | bool) or swap_size | int > (ansible_swaptotal_mb | int) + 1
|
- name: Delete swap file
|
||||||
block:
|
ansible.builtin.include_tasks: delete.yml
|
||||||
- name: Disable swap
|
when: not (swap_enabled | bool) or (swap_size | int > (ansible_swaptotal_mb | int) + 1)
|
||||||
ansible.builtin.shell: "test -f {{ swap_path }} && swapoff {{ swap_path }} || true"
|
|
||||||
changed_when: False
|
|
||||||
|
|
||||||
- name: Unmount swap file
|
|
||||||
ansible.posix.mount:
|
|
||||||
src: "{{ swap_path }}"
|
|
||||||
path: none
|
|
||||||
fstype: swap
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Remove swap file
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ swap_path }}"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- when:
|
|
||||||
- swap_enabled | bool
|
|
||||||
- swap_size | int > (ansible_swaptotal_mb | int) + 1
|
|
||||||
block:
|
|
||||||
- name: Create swap file
|
- name: Create swap file
|
||||||
ansible.builtin.command: "fallocate -l {{ swap_size }}M {{ swap_path }}"
|
ansible.builtin.include_tasks: create.yml
|
||||||
|
when: swap_enabled | bool
|
||||||
- name: Format swap file
|
|
||||||
ansible.builtin.command: "mkswap {{ swap_path }}"
|
|
||||||
|
|
||||||
- when: swap_enabled | bool
|
|
||||||
block:
|
|
||||||
- name: Fix file permissions
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ swap_path }}"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: "0600"
|
|
||||||
|
|
||||||
- name: Mount swap file
|
|
||||||
ansible.posix.mount:
|
|
||||||
src: "{{ swap_path }}"
|
|
||||||
path: none
|
|
||||||
fstype: swap
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Enable swap
|
|
||||||
ansible.builtin.command: "swapon -a"
|
|
||||||
changed_when: False
|
|
||||||
|
Loading…
Reference in New Issue
Block a user