Skip to content

Commit

Permalink
fix/improve-ci-and-resources-used (jdaln#16)
Browse files Browse the repository at this point in the history
CI improvments:

*    removed main branch CI because it is not used. Branch PR tests are currently enough.
*    removed cache apt step due to erroring and general complexity / unstability.
*   add linting and remove unused linting elements.
*  only run the linting related tasks on linting PRs to save resources.
  • Loading branch information
jdaln authored Jul 19, 2024
1 parent e5f0a78 commit 117098b
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 157 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ exclude_paths:
- .git/
- .github/
- .pre-commit-config.yaml
- testing/test-new-version-hardening.yml
warn_list:
- var-naming[no-role-prefix]
103 changes: 0 additions & 103 deletions .github/workflows/ci-vagrant-playbook-test.yml

This file was deleted.

15 changes: 2 additions & 13 deletions .github/workflows/deps-new-version-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
jobs:
vagrant-test-new-deps-version:
if: startsWith(github.head_ref, 'renovate/') # Checks if the source branch starts with "renovate/"
if: (!contains(github.event.pull_request.title, 'dependency ansible-lint')) # Checks the merge request except on some specific deps update
runs-on: ubuntu-22.04
env:
VAGRANT_DIR: ~/.vagrant.d/boxes
Expand All @@ -27,17 +27,6 @@ jobs:
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-disksize
- name: Cache apt packages
uses: actions/cache@v4
with:
path: |
/var/cache/apt/archives
/var/lib/apt/lists
key: ${{ runner.os }}-apt-${{ hashFiles('**/Dockerfile') }}
restore-keys: |
${{ runner.os }}-apt-
# Caches the downloaded apt packages to save time and bandwidth on subsequent runs

- name: Install requirements for Python and Ansible
run: |
pip install -r requirements.txt
Expand Down Expand Up @@ -91,7 +80,7 @@ jobs:
update-version-in-playbook:
needs: vagrant-test-new-deps-version # This job runs after vagrant-test-new-deps-version succeeds
runs-on: ubuntu-latest
if: success() && contains(github.event.pull_request.title, 'konstruktoid.hardening')
if: success() && contains(github.event.pull_request.title, 'dependency konstruktoid.hardening')
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on: [push, pull_request]
name: Ansible Lint

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@eb92667e07cc18e1d115ff02e5f07126310cec11 # main
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
# deb-server-management
Server management playbooks
# linux-server-management
Server management playbooks for Debian/Ubuntu based Linux.

### Pre-requisites

Pre-requisite commands depends on your OS.
Install the software needed to launch this and its automated testing scripts:

#### Debian-based Linux
```
sudo apt update
sudo apt install virtualbox vagrant python3-pip
```

#### Mac OS
Then, install the software needed to launch this and its automatic testing:
```
brew install vagrant
brew install python
python3 -m ensurepip --upgrade
brew install --cask virtualbox
brew install vagrant
```

### Before running anything from this repository
### Before running anything
Before running anything from this repository, install the following (after the Pre-requisites specific to your OS)
```
pip install -r requirements.txt
Expand Down
24 changes: 0 additions & 24 deletions action-lint/Dockerfile

This file was deleted.

11 changes: 0 additions & 11 deletions action-lint/entrypoint.sh

This file was deleted.

1 change: 1 addition & 0 deletions setup-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
ansible.builtin.include_role:
name: konstruktoid.hardening
vars:
# noqa: var-naming[no-role-prefix]
auditd_action_mail_acct: "{{ AUDITD_ACTION_MAIL_ACCT }}"
manage_ufw: "{{ MANAGE_UFW }}"
ufw_outgoing_traffic: "{{ UFW_OUTGOING_TRAFFIC }}"
Expand Down
2 changes: 1 addition & 1 deletion testing/vars.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is not automatically injected during the testing.
# This file is not automatically injected during the testing.
# You must add vars_files:
# - vars.yml
# in testing/being_tested.yml for it to be considered.
Expand Down

0 comments on commit 117098b

Please sign in to comment.