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

ci: add markdown linter and change to ubuntu 20.04 github runner #19

Closed
wants to merge 5 commits into from
Closed
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
10 changes: 7 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Pull Request

## Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

Expand All @@ -15,7 +18,8 @@ Please delete options that are not relevant.

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also
list any relevant details for your test configuration

- [ ] Ansible Molecule (Preferred)
- [ ] Local
Expand All @@ -37,7 +41,7 @@ Please describe the tests that you ran to verify your changes. Provide instructi
name: ROLENAME
```

## Checklist:
## Checklist

- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- distro: centos8
experimental: true
molecule_scenario: "-s default"
uses: trfore/ansible-role/.github/workflows/test_ansible.yml@main # remote repo
uses: ./.github/workflows/test.yml
with:
distro: ${{ matrix.distro }}
experimental: ${{ matrix.experimental }}
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Run Molecule Test
on:
workflow_call:
inputs:
distro:
required: true
type: string
experimental:
default: false
required: false
type: boolean
molecule_glob:
default: "molecule/*/molecule.yml"
required: false
type: string
molecule_scenario:
default: "" # ex: "-s SCENARIO_NAME"
required: false
type: string
requirements_file:
default: "requirements.txt"
required: false
type: string
jobs:
molecule:
runs-on: ubuntu-20.04
continue-on-error: ${{ inputs.experimental }}
env:
PY_COLORS: "1"
ANSIBLE_FORCE_COLOR: "1"
MOLECULE_GLOB: ${{ inputs.molecule_glob }}
MOLECULE_NAME: ${{ inputs.distro }}
MOLECULE_IMAGE: trfore/docker-${{ inputs.distro }}-systemd
steps:
- name: Check out codebase
uses: actions/checkout@v4

- name: Setup python 3
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install dependencies
run: pip install -r ${{ inputs.requirements_file }}

- name: Run molecule test
run: molecule test ${{ inputs.molecule_scenario }}
6 changes: 6 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
default: true

MD013:
line_length: 120
code_blocks: false
tables: false
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ repos:
hooks:
- id: prettier

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.40.0
hooks:
- id: markdownlint

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ tox -e py-ansible2.16-ubuntu20 run
tox run-parallel
```

- For iterative development and testing, the tox molecule environments are written to accept `molecule` arguments. This allows for codebase changes to be tested as you write across multiple distros and versions of `ansible-core`.
- For iterative development and testing, the tox molecule environments are written to accept `molecule` arguments. This
allows for codebase changes to be tested as you write across multiple distros and versions of `ansible-core`.

```sh
# molecule converge
Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@

Install Omada SDN controller on RedHat/CentOS and Debian/Ubuntu.

This role installs the latest Omada SDN controller software using the latest tarball from https://www.tp-link.com/us/support/download/omada-software-controller/.
This role installs the latest Omada SDN controller software using the latest tarball from [TP-Link (link)](https://www.tp-link.com/us/support/download/omada-software-controller/).

If you would like to manually download the tarball to your Ansible control host, download the `Omada_SDN_Controller_v5.*.*_Linux_x64.tar.gz`, to your `files` directory and set the following two variables in your playbook:
If you would like to manually download the tarball to your Ansible control host, download the
`Omada_SDN_Controller_v5.*.*_Linux_x64.tar.gz`, to your `files` directory and set the following two variables in your
playbook:

- `omada_tar_src: Omada_SDN_Controller_v5.*.*_Linux_x64.tar.gz`
- `omada_tar_src_remote: false`

See 'Example Playbooks' section for working examples. This role **does not configure the Omada controller**, it uses the default configuration values. It does set the service to run as a non-root user, you can change this by setting `omada_non_root: false`.
See 'Example Playbooks' section for working examples. This role **does not configure the Omada controller**, it uses the
default configuration values. It does set the service to run as a non-root user, you can change this by setting
`omada_non_root: false`.

### Install the Role
## Install the Role

You can install this role with the Ansible Galaxy CLI:

Expand All @@ -32,9 +36,11 @@ ansible-galaxy role install trfore.omada_install

## Requirements

- MongoDB Community Edition, `mongodb-org >=4.4.0`, a role for installing it via a package manager is available - `trfore.mongodb_install`.
- MongoDB Community Edition, `mongodb-org >=4.4.0`, a role for installing it via a package manager is available -
`trfore.mongodb_install`.
- Apache Commons Daemon, `jsvc >= 1.1.0`, a role for installing the **latest** binary is available - `trfore.jsvc`.
- You can install these roles by creating a `requirements.yml` file and running `ansible-galaxy install -r requirements.yml`.
- You can install these roles by creating a `requirements.yml` file and running
`ansible-galaxy install -r requirements.yml`.

```yaml
# requirements.yml
Expand All @@ -45,7 +51,9 @@ ansible-galaxy role install trfore.omada_install
- name: trfore.omada_install
```

- NOTE: For **Ubuntu 20.04** targets, this role installs **OpenJDK 11**. While `jsvc` is available via APT, it is `< 1.1.0` and will **only work with OpenJDK 8**. If you prefer to use this older version, set `omada_dependencies` to the following in your playbook (see 'Example Playbooks' section below):
- NOTE: For **Ubuntu 20.04** targets, this role installs **OpenJDK 11**. While `jsvc` is available via APT, it is
`< 1.1.0` and will **only work with OpenJDK 8**. If you prefer to use this older version, set `omada_dependencies` to
the following in your playbook (see 'Example Playbooks' section below):

```yaml
omada_dependencies: ["curl", "openjdk-8-jre-headless", "jsvc"]
Expand Down Expand Up @@ -145,7 +153,7 @@ MIT

## Author Information

Taylor Fore (https://github.com/trfore)
Taylor Fore (<https://github.com/trfore>)

## Related Roles

Expand All @@ -159,15 +167,15 @@ Taylor Fore (https://github.com/trfore)

### Omada

- https://www.tp-link.com/us/support/download/omada-software-controller/
- https://www.tp-link.com/us/support/faq/3272/
- <https://www.tp-link.com/us/support/download/omada-software-controller/>
- <https://www.tp-link.com/us/support/faq/3272/>
- Run Omada SDN as non-root
- https://www.tp-link.com/hk/support/faq/3583/
- <https://www.tp-link.com/hk/support/faq/3583/>
- Omada SDN Port List
- https://www.tp-link.com/us/support/faq/865/
- <https://www.tp-link.com/us/support/faq/865/>
- Omada Controller - Site Migration
- https://www.tp-link.com/us/omada-sdn/controller-upgrade/
- https://www.tp-link.com/us/omada-sdn/controller-upgrade/#content-5_1_2
- <https://www.tp-link.com/us/omada-sdn/controller-upgrade/>
- <https://www.tp-link.com/us/omada-sdn/controller-upgrade/#content-5_1_2>

[ansible-role-jsvc]: https://github.com/trfore/ansible-role-jsvc
[trfore.jsvc]: https://galaxy.ansible.com/trfore/jsvc
Expand Down
34 changes: 34 additions & 0 deletions meta/argument_specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# roles/omada_install/meta/argument_specs.yml
---
argument_specs:
main:
short_description: Install Omada SDN controller
description:
- Install Omada SDN controller on RedHat/CentOS and Debian/Ubuntu.
- The default values will install the latest Omada SDN controller software using the latest tarball from https://www.tp-link.com/us/support/download/omada-software-controller/.
- Optionally for Debian and Ubuntu, you can install the software using the .deb package, set `omada_pkg_install` to `true`.
options:
omada_non_root:
type: "bool"
default: true
description: "Configure Omada SDN to run as a non-root user."

omada_remove_tar_folder:
type: "bool"
default: false
description: "Remove the temporary directory, `omada_tar_dir`, on the remote host."

omada_tar_dir:
type: "path"
default: /var/tmp
description: "Temporary directory on the target host for extracting and installing Omada SDN."

omada_tar_src:
type: "str"
default: "https://static.tp-link.com/upload/software/[LATEST_TAR_FILE]"
description: "Omada SDN tar file, URL or relative path. Can be overridden in playbook."

omada_tar_src_remote:
type: "bool"
default: true
description: "Set to `true` if downloading tar file from remote source."
10 changes: 5 additions & 5 deletions requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-r ../requirements.txt
ansible>=7.4.0
ansible-compat>=4.1.7
ansible-lint>=6.14.0
molecule>=4.0.0,<25.0.0
molecule-plugins[docker]>=23.0.0
ansible==9.6.1
ansible-compat==24.6.1
ansible-lint==24.6.0
molecule==24.6.0
molecule-plugins[docker]==23.5.3
paramiko>=3.0.0
pre-commit>=3.2.0
pylint>=3.0.0
Expand Down
Loading