From 7c4e11927f30ab113f1f44257b31bc89a5cd11de Mon Sep 17 00:00:00 2001 From: Mateusz Suski Date: Mon, 4 May 2026 09:49:13 +0000 Subject: [PATCH] fixed ci.yml + added ansible.cfg file --- .gitea/workflows/ci.yml | 37 +++++++++++++++++++++----- enterprise-infra-simulator/ansible.cfg | 5 ++++ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 enterprise-infra-simulator/ansible.cfg diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c539835..dc2d22e 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -9,22 +9,47 @@ jobs: runs-on: ubuntu steps: - - uses: actions/checkout@v4 + # Checkout repository source code + - name: Checkout repository + uses: actions/checkout@v4 - - name: Install deps + # Install required system dependencies + # Includes Ansible, Docker (for molecule and compose), and Python tooling + - name: Install dependencies run: | apt-get update apt-get install -y python3 python3-pip ansible docker.io + pip3 install ansible-lint molecule molecule-plugins[docker] + # Basic Python syntax validation to catch immediate errors + # This avoids introducing runtime failures due to syntax issues - name: Python syntax check run: | find migration-validation-framework -name "*.py" -exec python3 -m py_compile {} \; + # Run Ansible lint to enforce best practices and detect potential issues + # Uses ansible.cfg from the project directory + - name: Ansible lint + run: | + cd enterprise-infra-simulator + ansible-lint + + # Perform syntax validation of all playbooks + # Ensures playbooks are structurally correct before execution - name: Ansible syntax check run: | - ansible-playbook -i enterprise-infra-simulator/inventory/hosts.ini \ - --syntax-check enterprise-infra-simulator/playbooks/*.yml + cd enterprise-infra-simulator + ansible-playbook --syntax-check playbooks/*.yml - - name: Docker compose validation + # Validate Docker Compose configuration + # Ensures compose file is valid and can be parsed correctly + - name: Docker Compose validation run: | - docker compose -f observability-stack/docker-compose.yml config \ No newline at end of file + docker compose -f observability-stack/docker-compose.yml config + + # Execute Molecule tests for Ansible roles + # This validates role behavior in an isolated container environment + - name: Molecule test + run: | + cd enterprise-infra-simulator + molecule test diff --git a/enterprise-infra-simulator/ansible.cfg b/enterprise-infra-simulator/ansible.cfg new file mode 100644 index 0000000..f295265 --- /dev/null +++ b/enterprise-infra-simulator/ansible.cfg @@ -0,0 +1,5 @@ +[defaults] +roles_path = ./roles +inventory = ./inventory/hosts.ini +host_key_checking = False +retry_files_enabled = False