added ansible tesT
All checks were successful
test / Linting (push) Successful in 26s
test / Molecule tests (default, ubuntu2004) (push) Successful in 1m30s
test / Molecule tests (default, debian11) (push) Successful in 1m51s
test / Molecule tests (default, debian12) (push) Successful in 2m3s
test / Molecule tests (with_custom_ascii, debian11) (push) Successful in 1m4s
test / Molecule tests (default, ubuntu2204) (push) Successful in 1m22s
test / Molecule tests (with_custom_ascii, debian12) (push) Successful in 1m15s
test / Molecule tests (with_custom_ascii, ubuntu2204) (push) Successful in 1m3s
test / Molecule tests (with_custom_ascii, ubuntu2004) (push) Successful in 1m23s
All checks were successful
test / Linting (push) Successful in 26s
test / Molecule tests (default, ubuntu2004) (push) Successful in 1m30s
test / Molecule tests (default, debian11) (push) Successful in 1m51s
test / Molecule tests (default, debian12) (push) Successful in 2m3s
test / Molecule tests (with_custom_ascii, debian11) (push) Successful in 1m4s
test / Molecule tests (default, ubuntu2204) (push) Successful in 1m22s
test / Molecule tests (with_custom_ascii, debian12) (push) Successful in 1m15s
test / Molecule tests (with_custom_ascii, ubuntu2204) (push) Successful in 1m3s
test / Molecule tests (with_custom_ascii, ubuntu2004) (push) Successful in 1m23s
This commit is contained in:
parent
f8cd38f7c2
commit
e1a216a90e
52
.gitea/workflows/test.yml
Normal file
52
.gitea/workflows/test.yml
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
name: test
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Linting
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: git.ednz.fr/container-factory/ansible-runner:act-latest
|
||||
credentials:
|
||||
username: ${{ secrets.ACTIONS_USER }}
|
||||
password: ${{ secrets.ACTIONS_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: "Ansible lint"
|
||||
run: ansible-lint --force-color
|
||||
working-directory: ${{ gitea.workspace }}
|
||||
|
||||
- name: "YAML lint"
|
||||
run: yamllint . -f colored -c .yamllint
|
||||
working-directory: ${{ gitea.workspace }}
|
||||
|
||||
molecule-test:
|
||||
name: Molecule tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint
|
||||
container:
|
||||
image: git.ednz.fr/container-factory/ansible-runner:act-latest
|
||||
credentials:
|
||||
username: ${{ secrets.ACTIONS_USER }}
|
||||
password: ${{ secrets.ACTIONS_TOKEN }}
|
||||
strategy:
|
||||
matrix:
|
||||
test_os: [debian11, debian12, ubuntu2004, ubuntu2204]
|
||||
scenario: [default, with_custom_ascii]
|
||||
env:
|
||||
ANSIBLE_HOST_KEY_CHECKING: 'false'
|
||||
ANSIBLE_FORCE_COLOR: 'true'
|
||||
ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: "Molecule test"
|
||||
run: molecule test -s ${{ matrix.scenario }}
|
||||
shell: bash
|
||||
working-directory: ${{ gitea.workspace }}
|
||||
env:
|
||||
MOLECULE_TEST_OS: ${{ matrix.test_os }}
|
@ -20,7 +20,7 @@ provisioner:
|
||||
defaults:
|
||||
remote_tmp: /tmp/.ansible
|
||||
verifier:
|
||||
name: testinfra
|
||||
name: ansible
|
||||
scenario:
|
||||
name: default
|
||||
test_sequence:
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Verify
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: "Test: file /etc/hosts"
|
||||
block:
|
||||
@ -17,3 +17,26 @@
|
||||
- stat_etc_hosts.stat.isreg
|
||||
- stat_etc_hosts.stat.pw_name == 'root'
|
||||
- stat_etc_hosts.stat.gr_name == 'root'
|
||||
|
||||
- name: "Test: file /etc/profile.d/motd.cfg"
|
||||
block:
|
||||
- name: "Stat file /etc/profile.d/motd.cfg"
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/profile.d/motd.cfg"
|
||||
register: stat_etc_profile_d_motd_cfg
|
||||
|
||||
- name: "Slurp file /etc/profile.d/motd.cfg"
|
||||
ansible.builtin.slurp:
|
||||
src: "/etc/profile.d/motd.cfg"
|
||||
register: slurp_etc_profile_d_motd_cfg
|
||||
|
||||
- name: "Verify file /etc/profile.d/motd.cfg"
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- stat_etc_profile_d_motd_cfg.stat.exists
|
||||
- stat_etc_profile_d_motd_cfg.stat.isreg
|
||||
- stat_etc_profile_d_motd_cfg.stat.pw_name == 'root'
|
||||
- stat_etc_profile_d_motd_cfg.stat.gr_name == 'root'
|
||||
- stat_etc_profile_d_motd_cfg.stat.mode == '0644'
|
||||
- "'print_info()' in (slurp_etc_profile_d_motd_cfg.content|b64decode)"
|
||||
- "'ascii_distro=\"auto\"' in (slurp_etc_profile_d_motd_cfg.content|b64decode)"
|
||||
|
@ -9,4 +9,4 @@ update_motd_print_info:
|
||||
module: local_ip
|
||||
- name: "Disk"
|
||||
module: "disk"
|
||||
update_motd_ascii_distro: "{{ ansible_distribution }}_small"
|
||||
update_motd_ascii_distro: "{{ ansible_distribution|lower }}_small"
|
||||
|
@ -20,7 +20,7 @@ provisioner:
|
||||
defaults:
|
||||
remote_tmp: /tmp/.ansible
|
||||
verifier:
|
||||
name: testinfra
|
||||
name: ansible
|
||||
scenario:
|
||||
name: with_custom_ascii
|
||||
test_sequence:
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
- name: Verify
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: "Test: file /etc/hosts"
|
||||
block:
|
||||
@ -17,3 +17,26 @@
|
||||
- stat_etc_hosts.stat.isreg
|
||||
- stat_etc_hosts.stat.pw_name == 'root'
|
||||
- stat_etc_hosts.stat.gr_name == 'root'
|
||||
|
||||
- name: "Test: file /etc/profile.d/motd.cfg"
|
||||
block:
|
||||
- name: "Stat file /etc/profile.d/motd.cfg"
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/profile.d/motd.cfg"
|
||||
register: stat_etc_profile_d_motd_cfg
|
||||
|
||||
- name: "Slurp file /etc/profile.d/motd.cfg"
|
||||
ansible.builtin.slurp:
|
||||
src: "/etc/profile.d/motd.cfg"
|
||||
register: slurp_etc_profile_d_motd_cfg
|
||||
|
||||
- name: "Verify file /etc/profile.d/motd.cfg"
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- stat_etc_profile_d_motd_cfg.stat.exists
|
||||
- stat_etc_profile_d_motd_cfg.stat.isreg
|
||||
- stat_etc_profile_d_motd_cfg.stat.pw_name == 'root'
|
||||
- stat_etc_profile_d_motd_cfg.stat.gr_name == 'root'
|
||||
- stat_etc_profile_d_motd_cfg.stat.mode == '0644'
|
||||
- "'print_info()' in (slurp_etc_profile_d_motd_cfg.content|b64decode)"
|
||||
- "'ascii_distro=\"{{ ansible_distribution|lower|string }}_small\"' in (slurp_etc_profile_d_motd_cfg.content|b64decode)"
|
||||
|
Loading…
Reference in New Issue
Block a user