Skip to content

Commit

Permalink
Check installed versions
Browse files Browse the repository at this point in the history
  • Loading branch information
buluma committed Jul 14, 2024
1 parent a6c163c commit 8d20a5e
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 32 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- main
- testing
- dependabot/**
# - renovate/**
paths-ignore:
- '**/README.md'
- '**/CHANGELOG.md'
Expand All @@ -21,8 +20,7 @@ on:
pull_request:
pull_request_target:
schedule:
# - cron: '29 15 15 * *'
- cron: '29 15 * * *'
- cron: '29 15 15/15 * *'

workflow_dispatch:

Expand All @@ -36,10 +34,10 @@ jobs:
lint:
runs-on: ubuntu-20.04
steps:
- name: checkout
- name: Checkout Role
uses: actions/checkout@v4
- name: ansible-lint
uses: ansible-community/ansible-lint-action@main
- name: Run Ansible-lint
uses: ansible/ansible-lint@v24.7.0
test:
needs:
- lint
Expand All @@ -52,16 +50,18 @@ jobs:
tag: "alpine-openrc"
- image: "enterpriselinux"
tag: "8"
- image: "enterpriselinux"
tag: "latest"
- image: "docker-molecule-images"
tag: "buster"
- image: "docker-molecule-images"
tag: "bullseye"
- image: "docker-molecule-images"
tag: "39"
tag: "fedora38"
- image: "docker-molecule-images"
tag: "40"
tag: "fedora39"
- image: "docker-molecule-images"
tag: "rawhide"
tag: "fedora40"
- image: "docker-molecule-images"
tag: "opensuse"
- image: "docker-molecule-images"
Expand All @@ -71,7 +71,9 @@ jobs:
- image: "docker-molecule-images"
tag: "jammy"
- image: "docker-molecule-images"
tag: "kalilinux"
tag: "noble"
- image: "docker-molecule-images"
tag: "lunar"
steps:
- name: Checkout Role
uses: actions/checkout@v4
Expand Down
36 changes: 23 additions & 13 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
---
extends: default

# https://ansible.readthedocs.io/projects/lint/rules/yaml/#octals
rules:
comments:
# /~https://github.com/prettier/prettier/issues/6780
min-spaces-from-content: 1
# /~https://github.com/adrienverge/yamllint/issues/384
comments-indentation: false
document-start: disable
# 160 chars was the default used by old E204 rule, but
# you can easily change it or disable in your .yamllint file.
line-length:
max: 290
# We are adding an extra space inside braces as that's how prettier does it
# and we are trying not to fight other linters.
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
truthy:
check-keys: false

ignore: |
.tox/
.cache/
min-spaces-inside: 0 # yamllint defaults to 0
max-spaces-inside: 1 # yamllint defaults to 0
# key-duplicates:
# forbid-duplicated-merge-keys: true # not enabled by default
octal-values:
forbid-implicit-octal: true # yamllint defaults to false
forbid-explicit-octal: true # yamllint defaults to false
# quoted-strings:
# quote-type: double
# required: only-when-needed
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ This example is taken from [`molecule/default/converge.yml`](/~https://github.com/
when: ansible_os_family == 'Debian'
changed_when: false

- name: Check if python3.11 EXTERNALLY-MANAGED file exists
ansible.builtin.stat:
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
register: externally_managed_file_py311

- name: Rename python3.11 EXTERNALLY-MANAGED file if it exists
ansible.builtin.command:
cmd: mv /usr/lib/python3.11/EXTERNALLY-MANAGED /usr/lib/python3.11/EXTERNALLY-MANAGED.old
when: externally_managed_file_py311.stat.exists
args:
creates: /usr/lib/python3.11/EXTERNALLY-MANAGED.old

- name: Check if python3.12 EXTERNALLY-MANAGED file exists
ansible.builtin.stat:
path: /usr/lib/python3.12/EXTERNALLY-MANAGED
register: externally_managed_file_py312

- name: Rename python3.12 EXTERNALLY-MANAGED file if it exists
ansible.builtin.command:
cmd: mv /usr/lib/python3.12/EXTERNALLY-MANAGED /usr/lib/python3.12/EXTERNALLY-MANAGED.old
when: externally_managed_file_py312.stat.exists
args:
creates: /usr/lib/python3.12/EXTERNALLY-MANAGED.old

roles:
- role: buluma.openssl
openssl_items:
Expand Down Expand Up @@ -109,14 +133,13 @@ This role has been tested on these [container images](https://hub.docker.com/u/b
|container|tags|
|---------|----|
|[Alpine](https://hub.docker.com/r/buluma/alpine)|all|
|[EL](https://hub.docker.com/r/buluma/enterpriselinux)|8|
|[EL](https://hub.docker.com/r/buluma/enterpriselinux)|8, 9|
|[Debian](https://hub.docker.com/r/buluma/debian)|all|
|[Fedora](https://hub.docker.com/r/buluma/fedora)|all|
|[Fedora](https://hub.docker.com/r/buluma/fedora)|38, 39, 40|
|[opensuse](https://hub.docker.com/r/buluma/opensuse)|all|
|[Ubuntu](https://hub.docker.com/r/buluma/ubuntu)|focal, bionic, jammy|
|[Kali](https://hub.docker.com/r/buluma/kali)|all|
|[Ubuntu](https://hub.docker.com/r/buluma/ubuntu)|focal, bionic, jammy, noble, lunar|
The minimum version of Ansible required is 2.12, tests have been done to:
The minimum version of Ansible required is 2.17, tests have been done to:
- The previous version.
- The current version.
Expand Down
10 changes: 6 additions & 4 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ galaxy_info:
- name: EL
versions:
- "8"
- "9"
- name: Debian
versions:
- all
- name: Fedora
versions:
- all
- "38"
- "39"
- "40"
- name: opensuse
versions:
- all
Expand All @@ -28,9 +31,8 @@ galaxy_info:
- focal
- bionic
- jammy
- name: Kali
versions:
- all
- noble
- lunar

galaxy_tags:
- openssl
Expand Down
19 changes: 19 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
---
# tasks file for openssl

- name: Check if python is installed

Check failure on line 4 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.command: which python
register: python_executable
ignore_errors: true

- name: Check if python3 is installed

Check failure on line 9 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.command: which python3
register: python3_executable
ignore_errors: true

- name: Debug Python executable path
ansible.builtin.debug:
var: python_executable.stdout

- name: Debug Python3 executable path
ansible.builtin.debug:
var: python3_executable.stdout


- name: Import assert.yml
ansible.builtin.import_tasks: assert.yml
run_once: true
Expand Down

0 comments on commit 8d20a5e

Please sign in to comment.