Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #45

Merged
merged 11 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
skip_list:
- 'yaml'
- 'risky-shell-pipe'
- 'role-name'
# skip_list:
# - 'yaml'
# - 'risky-shell-pipe'
# - 'role-name'
use_default_rules: true
verbosity: 1
30 changes: 7 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

lint:
name: Lint
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out the codebase.
uses: actions/[email protected]
Expand All @@ -45,39 +45,23 @@ jobs:
run: |
yamllint -c=.yamllint .

- name: Lint code ansible-lint.
- name: Run ansible-lint
run: |
ansible-lint
exit_code=0
expected_exit_code=0
ansible-lint || exit_code=$?
if [ "$exit_code" != "$expected_exit_code" ]; then echo "Command failed: got '$exit_code', expected '$expected_exit_code'"; exit 1; fi

molecule:
name: Molecule
needs: lint
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
distro:
- ubuntu2404
- ubuntu2204
- ubuntu2004
# - ubuntu1804 # TODO: WARNING Driver docker does not provide a schema
# - ubuntu1604 # TODO: fatal: [instance]: FAILED! =>
# {
# "ansible_facts": {},
# "changed": false,
# "failed_modules": {
# "ansible.legacy.setup": {
# "ansible_facts": {
# "discovered_interpreter_python": "/usr/bin/python3"
# },
# "failed": true,
# "msg": "ansible-core requires a minimum of Python2 version 2.7 or Python3 version 3.6. Current version: 3.5.2 (default, Jan 26 2021, 13:30:48) [GCC 5.4.0 20160609]"
# }
# },
# "msg": "The following modules failed to execute: ansible.legacy.setup\n"
# }
# - ubuntu1404 # TODO: ansible-core requires a minimum of Python2 version 2.7 or Python3 version 3.6. Current version: 3.4.3 (default, Nov 28 2017, 16:41:13) [GCC 4.8.4]
# - ubuntu1204 # DEPRECATED https://hub.docker.com/r/geerlingguy/docker-ubuntu1204-ansible

steps:
- name: Check out the codebase.
uses: actions/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:

jobs:
on-failure:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: send telegram message on fail build
Expand All @@ -28,7 +28,7 @@ jobs:
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
on-success:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
pages: write
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

release-ansible-galaxy:
name: Release ansible-galaxy
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out the codebase.
uses: actions/[email protected]
Expand All @@ -41,7 +41,7 @@ jobs:

srelease-git:
name: Release github
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: release-ansible-galaxy
steps:
- name: 🚀 Create Release version
Expand Down
4 changes: 3 additions & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rules:
line-length:
max: 200
level: warning
comments-indentation: false
comments:
# prettier compatibility
min-spaces-from-content: 1
Expand All @@ -16,10 +17,11 @@ rules:
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
braces:
max-spaces-inside: 1

ignore: |
.github/stale.yml
.travis.yml
venv
.tox
.cache/
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
tasks:
- name: Include bulch.rsync_server
ansible.legacy.include_role:
name: "bulch.rsync_server"
name: bulch.rsync_server

- name: Check uname
ansible.builtin.raw: uname -a
Expand Down
31 changes: 5 additions & 26 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
role_name_check: 1
dependency:
name: galaxy
options:
Expand All @@ -12,42 +13,18 @@ driver:

platforms:
- name: molecule-ubuntu
# image: ubuntu:18.04
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2404}-ansible:latest"
published_ports:
- 0.0.0.0:873:873/tcp
exposed_ports:
- 80/tcp
- 443/tcp
- 873/tcp

# platforms:
# - name: instance
# image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest"
# exposed_ports:
# - 80/tcp
# - 443/tcp
# published_ports:
# - 0.0.0.0:873:873/tcp
# volumes:
# - /sys/fs/cgroup:/sys/fs/cgroup:rw
# - /dev/null:/dev/null:rw
# # command: /sbin/init
# command: ${MOLECULE_DOCKER_COMMAND:-""}
# tmpfs:
# - /run
# - /tmp
# capabilities:
# - SYS_ADMIN
# cgroupns_mode: host
# privileged: true
# pre_build_image: true

provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}

inventory:
host_vars:
molecule-ubuntu:
Expand All @@ -56,6 +33,8 @@ provisioner:

verifier:
name: ansible
env:
ANSIBLE_ROLES_PATH: "../../roles"


lint: |
Expand Down
4 changes: 0 additions & 4 deletions molecule/default/roles/test-rsync_server/defaults/main.yml

This file was deleted.

17 changes: 14 additions & 3 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
---
# This is an example playbook to execute Ansible tests.
- name: Fail if molecule group is missing
hosts: localhost
tasks:
- name: Print some info
ansible.builtin.debug:
msg: "{{ groups }}"

- name: Assert group existence
ansible.builtin.assert:
that: "'molecule' in groups"
fail_msg: |
molecule group was not found inside inventory groups: {{ groups }}

- name: Verify
hosts: all
hosts: molecule
gather_facts: false
tasks:
- name: Include test-rsync_server
ansible.legacy.include_role:
name: "test-rsync_server"
name: testrsync_server
4 changes: 4 additions & 0 deletions roles/testrsync_server/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
testrsync_server_path_default_config_rsync: "/etc/default/rsync"
testrsync_server_path_secret_rsync: "/etc/rsyncd.secrets"
testrsync_server_path_rsync_config: "/etc/rsyncd.conf"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Test retrieve information from path
ansible.builtin.stat:
path: "{{ path_default_config_rsync }}"
path: "{{ testrsync_server_path_default_config_rsync }}"
register: default_config

- name: Test assert that file rsync config is created correctly
Expand All @@ -14,7 +14,7 @@

- name: Test retrieve information from path secret_rsync config
ansible.builtin.stat:
path: "{{ path_secret_rsync }}"
path: "{{ testrsync_server_path_secret_rsync }}"
register: secret_rsync

- name: Test assert that file secret_rsync is created correctly
Expand All @@ -27,7 +27,7 @@

- name: Test rsync_config retrieve information from path
ansible.builtin.stat:
path: "{{ path_rsync_config }}"
path: "{{ testrsync_server_path_rsync_config }}"
register: secret_rsync

- name: Test assert that file rsync_config is created correctly
Expand Down
2 changes: 1 addition & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
hosts: molecule-ubuntu
remote_user: root
roles:
- bulch.rsync_server
- testrsync_server