diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md index ca7f848..a2729ee 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -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) @@ -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 @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 767912d..294c59a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7b27be2 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 }} diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..a42dd24 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,6 @@ +default: true + +MD013: + line_length: 120 + code_blocks: false + tables: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 66bf309..3514654 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6013ee..be01cd9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/README.md b/README.md index 65573d1..cdee55f 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 @@ -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"] @@ -145,7 +153,7 @@ MIT ## Author Information -Taylor Fore (https://github.com/trfore) +Taylor Fore () ## Related Roles @@ -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/ +- +- - Run Omada SDN as non-root - - https://www.tp-link.com/hk/support/faq/3583/ + - - Omada SDN Port List - - 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 + - + - [ansible-role-jsvc]: https://github.com/trfore/ansible-role-jsvc [trfore.jsvc]: https://galaxy.ansible.com/trfore/jsvc diff --git a/meta/argument_specs.yml b/meta/argument_specs.yml new file mode 100644 index 0000000..0f42edf --- /dev/null +++ b/meta/argument_specs.yml @@ -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." diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt index 227ef4c..95a8513 100644 --- a/requirements/dev-requirements.txt +++ b/requirements/dev-requirements.txt @@ -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