Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
antmelekhin committed Nov 10, 2023
0 parents commit 4ffeb9e
Show file tree
Hide file tree
Showing 29 changed files with 453 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
skip_list:
- 'role-name'
31 changes: 31 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: 'Molecule'
on:
pull_request:
push:
branches:
- main

jobs:
test:
name: 'Test'
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: 'debian-12'
- distro: 'rockylinux-9'
- distro: 'ubuntu-22.04'

steps:
- name: 'Checkout the codebase'
uses: actions/checkout@v3

- name: 'Test role'
uses: gofrolist/molecule-action@v2
with:
molecule_command: test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
TAG: ${{ matrix.distro }}
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: 'Publish'
on:
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: 'Checkout the codebase'
uses: actions/checkout@v3

- name: 'Publish to Ansible Galaxy'
uses: robertdebock/[email protected]
with:
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
git_branch: main
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: 'Release'
on:
push:
branches:
- main

jobs:
release:
name: 'Release'
runs-on: ubuntu-latest
# Skip running release workflow on forks
if: github.repository_owner == 'antmelekhin'
steps:
- name: 'Checkout the codebase'
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- name: 'Semantic Release'
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19.0.5
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
94 changes: 94 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
branches: ['main']
preset: 'conventionalcommits'
ci: false

verifyConditions:
- '@semantic-release/changelog'
- '@semantic-release/git'
- '@semantic-release/github'

analyzeCommits:
- path: '@semantic-release/commit-analyzer'
releaseRules:
- type: 'breaking'
release: 'major'
- type: 'chore'
release: false
- type: 'ci'
release: false
- type: 'docs'
release: false
- type: 'feat'
release: 'minor'
- type: 'fix'
release: 'patch'
- type: 'improv'
release: 'minor'
- type: 'refactor'
release: 'patch'
- type: 'revert'
release: 'patch'
- type: 'style'
release: false
- type: 'test'
release: false

generateNotes:
- path: '@semantic-release/release-notes-generator'
writerOpts:
groupBy: 'type'
commitGroupsSort: 'title'
commitsSort: 'header'
linkCompare: true
linkReferences: true
presetConfig:
types:
- type: 'breaking'
section: 'Breaking changes!'
hidden: false
- type: 'chore'
section: 'Miscellaneous Chores'
hidden: true
- type: 'ci'
section: 'Continuous Integration'
hidden: false
- type: 'docs'
section: 'Documentation'
hidden: false
- type: 'feat'
section: 'Features'
hidden: false
- type: 'fix'
section: 'Fixes'
hidden: false
- type: 'improv'
section: 'Improvements'
hidden: false
- type: 'refactor'
section: 'Code Refactoring'
hidden: false
- type: 'revert'
section: 'Reverts'
hidden: false
- type: 'style'
section: 'Styles'
hidden: false
- type: 'test'
section: 'Tests'
hidden: false

prepare:
- path: '@semantic-release/changelog'
changelogFile: 'CHANGELOG.md'
changelogTitle: '# Changelog'
- path: '@semantic-release/git'
assets: ['CHANGELOG.md']
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"

publish:
- path: '@semantic-release/github'

success: false

fail: false
33 changes: 33 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# Based on ansible-lint config
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Anton Melekhin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Java
====

An Ansible role for install Java.

Requirements
------------

- Supported version of Ansible: 2.12 and highter.
- Supported platforms:
- Debian
- 10
- 11
- 12
- RHEL
- 7
- 8
- 9
- Ubuntu
- 18.04
- 20.04
- 22.04

Role Variables
--------------

- `java_packages` List of `Java` packages (see default values in `vars/*.yml`).

Dependencies
------------

None.

Example Playbook
----------------

- Install `Java` package:

```yaml
---

- name: 'Install Java package'
hosts: all

roles:
- role: antmelekhin.java
```
License
-------
MIT
Author Information
------------------
Melekhin Anton.
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
java_packages: '{{ _java_packages }}'
33 changes: 33 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
galaxy_info:
author: antmelekhin
role_name: java
description: An Ansible role for install Java.

license: MIT

min_ansible_version: '2.12'

platforms:
- name: Debian
versions:
- 'buster'
- 'bullseye'
- 'bookworm'
- name: EL
versions:
- '7'
- '8'
- '9'
- name: Ubuntu
versions:
- 'bionic'
- 'focal'
- 'jammy'

galaxy_tags:
- 'openjdk'
- 'java'
- 'jdk'

dependencies: []
5 changes: 5 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Converge
hosts: all
roles:
- role: antmelekhin.java
23 changes: 23 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
dependency:
name: galaxy
enabled: true
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: '${IMAGE:-docker-systemd}-${TAG:-ubuntu-22.04}${TOX_ENVNAME}'
image: '${NAMESPACE:-antmelekhin}/${IMAGE:-docker-systemd}:${TAG:-ubuntu-22.04}'
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
15 changes: 15 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: 'Verify'
hosts: all
gather_facts: false

tasks:
- name: 'Check current Java version'
ansible.builtin.command:
cmd: java --version
changed_when: false
register: _java_version_check

- name: 'Java version output'
ansible.builtin.debug:
msg: '{{ _java_version_check.stdout }}'
7 changes: 7 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: 'Set JAVA_HOME if configured'
ansible.builtin.template:
src: 'java_home.sh.j2'
dest: '/etc/profile.d/java_home.sh'
mode: 0755
when: java_home is defined and java_home
7 changes: 7 additions & 0 deletions tasks/install-Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: 'Install Java packages'
ansible.builtin.apt:
name: '{{ java_packages }}'
update_cache: true
state: present
become: true
Loading

0 comments on commit 4ffeb9e

Please sign in to comment.