Skip to content

Commit

Permalink
Add Tomcat skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
bviktor committed Jan 19, 2023
0 parents commit 816536a
Show file tree
Hide file tree
Showing 18 changed files with 294 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
skip_list:
- git-latest
- package-latest
- fqcn[action]
- fqcn[action-core]
- yaml[comments] # TODO how do I restrict this to just require-starting-space?
- yaml[line-length]
- name # this is covered by yamllint with exceptions on include_role
- risky-shell-pipe
- schema[tasks] # TODO ansible-lint randomly complains, e.g. it/tftpd
- role-name
- schema[meta] # TODO ansible-lint believes the official dependency syntax is wrong
- meta-no-info # we leave platform empty
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.yml linguist-detectable=true
4 changes: 4 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

yamllint --strict .
ansible-lint --strict
25 changes: 25 additions & 0 deletions .github/workflows/almalinux-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: AlmaLinux 8

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- master
pull_request:
branches: []

jobs:
ansible-ci:
runs-on: ubuntu-latest
steps:
- name: Obtain sources
uses: actions/checkout@v3
- name: Test Galaxy role
run: >
CONT_ID=$(podman run --rm -v ${{ github.workspace }}:/repo -v /sys/fs/cgroup:/sys/fs/cgroup:ro
--tmpfs /tmp --tmpfs /run --privileged --detach bviktor/ansible-systemd-almalinux:8) &&
podman exec ${CONT_ID} /bin/bash -c
"if [ -f requirements.yml ]; then ansible-galaxy role install --force -r requirements.yml -p ..; fi &&
ANSIBLE_ROLES_PATH=.. ANSIBLE_FORCE_COLOR=true ansible-playbook tests/main.yml" &&
podman stop ${CONT_ID}
25 changes: 25 additions & 0 deletions .github/workflows/almalinux-9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: AlmaLinux 9

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- master
pull_request:
branches: []

jobs:
ansible-ci:
runs-on: ubuntu-latest
steps:
- name: Obtain sources
uses: actions/checkout@v3
- name: Test Galaxy role
run: >
CONT_ID=$(podman run --rm -v ${{ github.workspace }}:/repo -v /sys/fs/cgroup:/sys/fs/cgroup:ro
--tmpfs /tmp --tmpfs /run --privileged --detach bviktor/ansible-systemd-almalinux:9) &&
podman exec ${CONT_ID} /bin/bash -c
"if [ -f requirements.yml ]; then ansible-galaxy role install --force -r requirements.yml -p ..; fi &&
ANSIBLE_ROLES_PATH=.. ANSIBLE_FORCE_COLOR=true ansible-playbook tests/main.yml" &&
podman stop ${CONT_ID}
25 changes: 25 additions & 0 deletions .github/workflows/fedora-37.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Fedora 37

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- master
pull_request:
branches: []

jobs:
ansible-ci:
runs-on: ubuntu-latest
steps:
- name: Obtain sources
uses: actions/checkout@v3
- name: Test Galaxy role
run: >
CONT_ID=$(podman run --rm -v ${{ github.workspace }}:/repo -v /sys/fs/cgroup:/sys/fs/cgroup:ro
--tmpfs /tmp --tmpfs /run --privileged --detach bviktor/ansible-systemd-fedora:37) &&
podman exec ${CONT_ID} /bin/bash -c
"if [ -f requirements.yml ]; then ansible-galaxy role install --force -r requirements.yml -p ..; fi &&
ANSIBLE_ROLES_PATH=.. ANSIBLE_FORCE_COLOR=true ansible-playbook tests/main.yml" &&
podman stop ${CONT_ID}
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Lint

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- master
pull_request:
branches: []

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Obtain sources
uses: actions/checkout@v3
- name: Lint sources
run: >
podman run --rm -v ${{ github.workspace }}:/repo bviktor/ansible-systemd-lint:latest /bin/bash -c
"git config --global --add safe.directory /repo &&
yamllint --strict . &&
ansible-lint --strict"
25 changes: 25 additions & 0 deletions .github/workflows/ubuntu-18.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Ubuntu 18.04

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- master
pull_request:
branches: []

jobs:
ansible-ci:
runs-on: ubuntu-latest
steps:
- name: Obtain sources
uses: actions/checkout@v3
- name: Test Galaxy role
run: >
CONT_ID=$(podman run --rm -v ${{ github.workspace }}:/repo -v /sys/fs/cgroup:/sys/fs/cgroup:ro
--tmpfs /tmp --tmpfs /run --privileged --detach bviktor/ansible-systemd-ubuntu:18.04) &&
podman exec ${CONT_ID} /bin/bash -c
"if [ -f requirements.yml ]; then ansible-galaxy role install --force -r requirements.yml -p ..; fi &&
ANSIBLE_ROLES_PATH=.. ANSIBLE_FORCE_COLOR=true ansible-playbook tests/main.yml" &&
podman stop ${CONT_ID}
25 changes: 25 additions & 0 deletions .github/workflows/ubuntu-20.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Ubuntu 20.04

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- master
pull_request:
branches: []

jobs:
ansible-ci:
runs-on: ubuntu-latest
steps:
- name: Obtain sources
uses: actions/checkout@v3
- name: Test Galaxy role
run: >
CONT_ID=$(podman run --rm -v ${{ github.workspace }}:/repo -v /sys/fs/cgroup:/sys/fs/cgroup:ro
--tmpfs /tmp --tmpfs /run --privileged --detach bviktor/ansible-systemd-ubuntu:20.04) &&
podman exec ${CONT_ID} /bin/bash -c
"if [ -f requirements.yml ]; then ansible-galaxy role install --force -r requirements.yml -p ..; fi &&
ANSIBLE_ROLES_PATH=.. ANSIBLE_FORCE_COLOR=true ansible-playbook tests/main.yml" &&
podman stop ${CONT_ID}
25 changes: 25 additions & 0 deletions .github/workflows/ubuntu-22.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Ubuntu 22.04

on: # yamllint disable-line rule:truthy
push:
branches:
- main
- master
pull_request:
branches: []

jobs:
ansible-ci:
runs-on: ubuntu-latest
steps:
- name: Obtain sources
uses: actions/checkout@v3
- name: Test Galaxy role
run: >
CONT_ID=$(podman run --rm -v ${{ github.workspace }}:/repo -v /sys/fs/cgroup:/sys/fs/cgroup:ro
--tmpfs /tmp --tmpfs /run --privileged --detach bviktor/ansible-systemd-ubuntu:22.04) &&
podman exec ${CONT_ID} /bin/bash -c
"if [ -f requirements.yml ]; then ansible-galaxy role install --force -r requirements.yml -p ..; fi &&
ANSIBLE_ROLES_PATH=.. ANSIBLE_FORCE_COLOR=true ansible-playbook tests/main.yml" &&
podman stop ${CONT_ID}
10 changes: 10 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
extends: default

rules:
braces:
max-spaces-inside: 1
comments:
min-spaces-from-content: 1
require-starting-space: false
line-length: 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 Viktor Berke

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.
9 changes: 9 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
galaxy_info:
role_name: tomcat
author: Viktor Berke
description: Install, configure, upgrade Tomcat instances
license: license (MIT)
min_ansible_version: '2.10'
platforms: []
galaxy_tags: []
38 changes: 38 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# bviktor.tomcat

## Synopsys

This role installs, configures, and upgrades Tomcat instances.

## Parameters

| Name | Required | Example | Description |
|---|---|---|---|
| `uid` | no | `1234` | UID to run Tomcat under. Defaults to `53`. |
| `gid` | no | `1234` | GID to run Tomcat under. Defaults to `53`. |

## Examples

```yml
- include_role:
name: bviktor.tomcat
vars:
uid: 1234
gid: 1234
```
## Return Values
N/A
## Support
| Platform | Support | Status |
|---|---|---|
| Linter | ✅ | [![Lint](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/lint.yml/badge.svg)](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/lint.yml) |
| AlmaLinux 8 | ✅ | [![AlmaLinux 8](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/almalinux-8.yml/badge.svg)](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/almalinux-8.yml) |
| AlmaLinux 9 | ✅ | [![AlmaLinux 9](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/almalinux-9.yml/badge.svg)](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/almalinux-9.yml) |
| Fedora 37 | ✅ | [![Fedora 37](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/fedora-37.yml/badge.svg)](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/fedora-37.yml) |
| Ubuntu 18.04 | ✅ | [![Ubuntu 18.04](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/ubuntu-18.04.yml/badge.svg)](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/ubuntu-18.04.yml) |
| Ubuntu 20.04 | ✅ | [![Ubuntu 20.04](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/ubuntu-20.04.yml/badge.svg)](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/ubuntu-20.04.yml) |
| Ubuntu 22.04 | ✅ | [![Ubuntu 22.04](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/ubuntu-22.04.yml/badge.svg)](https://github.com/noobient/ansible-galaxy-tomcat/actions/workflows/ubuntu-22.04.yml) |
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
- include_tasks: unixcred.yml
11 changes: 11 additions & 0 deletions tasks/unixcred.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Create Tomcat Unix grop
group:
name: tomcat
gid: "{{ gid | default(tomcat_id) }}"

- name: Create Tomcat Unix user
user:
name: tomcat
uid: "{{ uid | default(tomcat_id) }}"
group: tomcat
8 changes: 8 additions & 0 deletions tests/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- hosts: 127.0.0.1
tasks:
- include_role:
name: "{{ playbook_dir.split('/')[:-1] | last }}"
vars:
uid: 1234
gid: '1234'
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# this is the ID used on CentOS 7, let's default to that
tomcat_id: 53

0 comments on commit 816536a

Please sign in to comment.