Initial devtools commit
Change-Id: Ia7b7afa7c5b310edfdb612c77fae49830a7bf5e7
diff --git a/.reuse/dep5 b/.reuse/dep5
new file mode 100644
index 0000000..a42b189
--- /dev/null
+++ b/.reuse/dep5
@@ -0,0 +1,5 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files: VERSION README.md
+Copyright: 2022 Open Networking Foundation
+License: Apache-2.0
diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSES/Apache-2.0.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..cdeb5f9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,42 @@
+# devtools Makefile
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+SHELL = bash -eu -o pipefail
+
+.DEFAULT_GOAL := help
+.PHONY: test lint yamllint ansiblelint license help
+
+test: ## run tests on the playbook with molecule
+ molecule --version
+ molecule test
+
+lint: license yamllint ansiblelint ## run all lint checks
+
+# all YAML files
+YAML_FILES ?= $(shell find . -type f \( -name '*.yaml' -o -name '*.yml' \) -print )
+
+license: ## Check license with the reuse tool
+ reuse --version
+ reuse --root . lint
+
+yamllint: ## lint check with yamllint
+ yamllint --version
+ yamllint \
+ -d "{extends: default, rules: {line-length: {max: 99}}}" \
+ -s $(YAML_FILES)
+
+# List of molecule files, not including base molecule.yml which isn't ansible format
+MOLECULE_FILES ?= $(shell find molecule -type f -name '*.yml' \! -name 'molecule.yml' -print )
+
+ansiblelint: ## lint check with ansible-lint
+ ansible-lint --version
+ ansible-lint -v .
+ ansible-lint -v $(MOLECULE_FILES)
+
+help: ## Print help for each target
+ @echo devtools test targets
+ @echo
+ @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
+ | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7fc15d3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,17 @@
+# devtools
+
+Installs tools for development on CI systems
+
+## Example Playbook
+
+```yaml
+- hosts: all
+ roles:
+ - devtools
+```
+
+## License and Author
+
+Copyright 2022 Open Networking Foundation <support@opennetworking.org>
+
+License: Apache-2.0
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..c0ab82c
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.0.1-dev
diff --git a/defaults/main.yml b/defaults/main.yml
new file mode 100644
index 0000000..b4daffc
--- /dev/null
+++ b/defaults/main.yml
@@ -0,0 +1,95 @@
+---
+# devtools defaults/main.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+devtools_extras: []
+
+# code review and lint tools
+devtools_python_piptools:
+ - git-review~=2.3.1
+ - reuse~=0.14.0
+ - yamllint~=1.26.3
+
+devtools_repo_version: "2.25"
+devtools_repo_url: >-
+ https://gerrit.googlesource.com/git-repo/+/refs/tags/v{{
+ devtools_repo_version }}/repo?format=TEXT
+devtools_repo_checksum: "sha256:b727e5836b1b406a38b61789dc2b39f83206f3a1fc158744714e2a384cd7634b"
+
+devtools_shellcheck_version: "0.8.0"
+devtools_shellcheck_url: >-
+ https://github.com/koalaman/shellcheck/releases/download/v{{
+ devtools_shellcheck_version }}/shellcheck-v{{
+ devtools_shellcheck_version }}.linux.x86_64.tar.xz
+devtools_shellcheck_checksum: >-
+ sha256:ab6ee1b178f014d1b86d1e24da20d1139656c8b0ed34d2867fbb834dad02bf0a
+
+devtools_yq_version: "4.11.2"
+devtools_yq_url:
+ https://github.com/mikefarah/yq/releases/download/v{{
+ devtools_yq_version }}/yq_linux_amd64
+devtools_yq_checksum: "sha256:6b891fd5bb13820b2f6c1027b613220a690ce0ef4fc2b6c76ec5f643d5535e61"
+
+# bazel
+devtools_bazelisk_version: "1.11.0"
+devtools_bazelisk_url: >-
+ https://github.com/bazelbuild/bazelisk/releases/download/v{{
+ devtools_bazelisk_version }}/bazelisk-linux-amd64
+devtools_bazelisk_checksum: >-
+ sha256:231ec5ca8115e94c75a1f4fbada1a062b48822ca04f21f26e4cb1cd8973cd458
+
+# kubernetes
+devtools_kubectl_version: "1.22.6"
+devtools_kubectl_url: >-
+ https://storage.googleapis.com/kubernetes-release/release/v{{
+ devtools_kubectl_version }}/bin/linux/amd64/kubectl
+devtools_kubectl_checksum: >-
+ sha256:1ab07643807a45e2917072f7ba5f11140b40f19675981b199b810552d6af5c53
+
+devtools_kind_version: "0.13.0"
+devtools_kind_url: >-
+ https://github.com/kubernetes-sigs/kind/releases/download/v{{
+ devtools_kind_version }}/kind-linux-amd64
+devtools_kind_checksum: "sha256:c80c6d1013337cbbe226c2eda0a3dc2d75af16e5fa8af4ce3fc9fedcf1f9d2dc"
+
+devtools_helm_version: "3.8.2"
+devtools_helm_url: "https://get.helm.sh/helm-v{{ devtools_helm_version }}-linux-amd64.tar.gz"
+devtools_helm_checksum: "sha256:6cb9a48f72ab9ddfecab88d264c2f6508ab3cd42d9c09666be16a7bf006bed7b"
+
+devtools_kubeval_version: "0.16.1"
+devtools_kubeval_url: >-
+ https://github.com/instrumenta/kubeval/releases/download/v{{
+ devtools_kubeval_version }}/kubeval-linux-amd64.tar.gz
+devtools_kubeval_checksum: >-
+ sha256:2d6f9bda1423b93787fa05d9e8dfce2fc1190fefbcd9d0936b9635f3f78ba790
+
+devtools_conftest_version: "0.32.0"
+devtools_conftest_url: >-
+ https://github.com/open-policy-agent/conftest/releases/download/v{{
+ devtools_conftest_version }}/conftest_{{
+ devtools_conftest_version }}_Linux_x86_64.tar.gz
+devtools_conftest_checksum: >-
+ sha256:e368ef4fcb49885e9c89052ec0c29cf4d4587707a589fefcaa3dc9cc72065055
+
+devtools_fleet_version: "0.3.9"
+devtools_fleet_url: >-
+ https://github.com/rancher/fleet/releases/download/v{{
+ devtools_fleet_version }}/fleet-linux-amd64
+devtools_fleet_checksum: "sha256:9e337fe898f0683c58d527c09df333e95403ea3c1fcc8ebf64a8b5d8e403275e"
+
+# terraform
+devtools_terraform_version: "1.1.9"
+devtools_terraform_url: >-
+ https://releases.hashicorp.com/terraform/{{
+ devtools_terraform_version }}/terraform_{{
+ devtools_terraform_version }}_linux_amd64.zip
+devtools_terraform_checksum: >-
+ sha256:9d2d8a89f5cc8bc1c06cb6f34ce76ec4b99184b07eb776f8b39183b513d7798a
+
+devtools_tfmask_version: "0.7.0"
+devtools_tfmask_url: >-
+ https://github.com/cloudposse/tfmask/releases/download/{{
+ devtools_tfmask_version }}/tfmask_linux_amd64
+devtools_tfmask_checksum: "sha256:36db69e2c01f135ed8775312121ec0b0dd1e78748f54cf4ced206f6f632bcc85"
diff --git a/handlers/main.yml b/handlers/main.yml
new file mode 100644
index 0000000..f87fce6
--- /dev/null
+++ b/handlers/main.yml
@@ -0,0 +1,5 @@
+---
+# devtools handlers/main.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
diff --git a/meta/main.yml b/meta/main.yml
new file mode 100644
index 0000000..b4c3201
--- /dev/null
+++ b/meta/main.yml
@@ -0,0 +1,32 @@
+---
+# devtools meta/main.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+galaxy_info:
+ role_name: devtools
+ namespace: onf
+
+ author: Open Networking Foundation
+ description: Installs tools for development on CI systems
+ company: Open Networking Foundation
+
+ issue_tracker_url: https://jira.opennetworking.org/
+
+ license: Apache-2.0
+
+ min_ansible_version: 2.10.7
+
+ platforms:
+ - name: Ubuntu
+ versions:
+ - bionic
+ - name: Debian
+ versions:
+ - bullseye
+
+ galaxy_tags:
+ - devtools
+
+dependencies: []
diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml
new file mode 100644
index 0000000..59ff0d8
--- /dev/null
+++ b/molecule/default/converge.yml
@@ -0,0 +1,23 @@
+---
+# devtools molecule/default/verify.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: Converge
+ hosts: all
+
+ vars:
+ devtools_install:
+ - bazel
+ - chromium
+ - java11
+ - k8s
+ - shellcheck
+ - terraform
+ - yq
+
+ tasks:
+ - name: "Include devtools"
+ include_role:
+ name: "devtools"
diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml
new file mode 100644
index 0000000..2d796f6
--- /dev/null
+++ b/molecule/default/molecule.yml
@@ -0,0 +1,24 @@
+---
+# devtools molecule/default/molecule.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+dependency:
+ name: galaxy
+driver:
+ name: docker
+platforms:
+ - name: "debian-11-priv"
+ image: "onfinfra/molecule-systemd:debian-11"
+ privileged: true
+ volumes:
+ - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
+provisioner:
+ name: ansible
+ inventory:
+ host_vars:
+ debian-11-priv:
+ ansible_python_interpreter: /usr/bin/python3
+verifier:
+ name: ansible
diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml
new file mode 100644
index 0000000..8a6323c
--- /dev/null
+++ b/molecule/default/verify.yml
@@ -0,0 +1,189 @@
+---
+# devtools molecule/default/verify.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: Verify
+ hosts: all
+ tasks:
+
+ # bazelisk
+ # Can't be checked, will download bazel if run with --version
+
+ # chromium
+ - name: Check chromium version
+ command:
+ cmd: "chromium --version"
+ become: true
+ register: chromium_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: chromium_version
+
+ - name: Assert chromium installed
+ assert:
+ that:
+ - "'Chromium' in chromium_version.stdout"
+
+ # java
+ - name: Check java version
+ command:
+ cmd: "java --version"
+ become: true
+ register: java_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: java_version
+
+ - name: Assert java 11 installed
+ assert:
+ that:
+ - "'openjdk 11' in java_version.stdout"
+
+ # kubectl
+ - name: Check kubectl version
+ command:
+ cmd: "kubectl version --client"
+ become: true
+ register: kubectl_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: kubectl_version
+
+ - name: Assert kubectl 1.22 installed
+ assert:
+ that:
+ - "'Client Version: version.Info{Major:\"1\", Minor:\"22\"' in kubectl_version.stdout"
+
+ # kind
+ - name: Check kind version
+ command:
+ cmd: "kind --version"
+ become: true
+ register: kind_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: kind_version
+
+ - name: Assert kind 0.13.x installed
+ assert:
+ that:
+ - "'kind version 0.13' in kind_version.stdout"
+
+ # helm
+ - name: Check helm version
+ command:
+ cmd: "helm version"
+ become: true
+ register: helm_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: helm_version
+
+ - name: Assert helm 3.8.x installed
+ assert:
+ that:
+ - "'Version:\"v3.8' in helm_version.stdout"
+
+ # kubeval
+ - name: Check kubeval version
+ command:
+ cmd: "kubeval --version"
+ become: true
+ register: kubeval_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: kubeval_version
+
+ - name: Assert kubeval 0.16.x installed
+ assert:
+ that:
+ - "'Version: 0.16' in kubeval_version.stdout"
+
+ # conftest
+ - name: Check conftest version
+ command:
+ cmd: "conftest --version"
+ become: true
+ register: conftest_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: conftest_version
+
+ - name: Assert conftest 0.32.x installed
+ assert:
+ that:
+ - "'Conftest: 0.32' in conftest_version.stdout"
+
+ # fleet
+ - name: Check fleet version
+ command:
+ cmd: "fleet --version"
+ become: true
+ register: fleet_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: fleet_version
+
+ - name: Assert fleet 0.3.x installed
+ assert:
+ that:
+ - "'fleet version v0.3' in fleet_version.stdout"
+
+ # shellcheck
+ # dies when run under qemu, not checked
+
+ # terraform
+ - name: Check terraform version
+ command:
+ cmd: "terraform --version"
+ become: true
+ register: terraform_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: terraform_version
+
+ - name: Assert terraform 1.1.x installed
+ assert:
+ that:
+ - "'Terraform v1.1' in terraform_version.stdout"
+
+ # tfmask
+ # no version/test command
+
+ # yq
+ - name: Check yq version
+ command:
+ cmd: "yq --version"
+ become: true
+ register: yq_version
+ tags:
+ - skip_ansible_lint # info gathering
+
+ - debug:
+ var: yq_version
+
+ - name: Assert yq 4.11.x installed
+ assert:
+ that:
+ - "'yq (https://github.com/mikefarah/yq/) version 4.11' in yq_version.stdout"
+
diff --git a/tasks/Debian.yml b/tasks/Debian.yml
new file mode 100644
index 0000000..b61b40e
--- /dev/null
+++ b/tasks/Debian.yml
@@ -0,0 +1,34 @@
+---
+# devtools tasks/Debian.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: install base Debian tools
+ apt:
+ name:
+ - acl
+ - apt-transport-https
+ - build-essential
+ - ca-certificates
+ - curl
+ - file
+ - git
+ - git-crypt
+ - gnupg
+ - jq
+ - libenchant-2-dev
+ - libxml2-utils
+ - python-is-python3
+ - python3
+ - python3-dev
+ - python3-pip
+ - python3-venv
+ - rsync
+ - sshpass
+ - sudo
+ - tar
+ - unzip
+ state: present
+ update_cache: true
+ cache_valid_time: 3600
diff --git a/tasks/bazel.yml b/tasks/bazel.yml
new file mode 100644
index 0000000..d730ee7
--- /dev/null
+++ b/tasks/bazel.yml
@@ -0,0 +1,13 @@
+---
+# devtools tasks/bazel.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+# bazelisk
+- name: Download/install bazelisk binary
+ get_url:
+ url: "{{ devtools_bazelisk_url }}"
+ checksum: "{{ devtools_bazelisk_checksum }}"
+ dest: /usr/local/bin/bazel
+ mode: "0755"
diff --git a/tasks/chromium.yml b/tasks/chromium.yml
new file mode 100644
index 0000000..b432191
--- /dev/null
+++ b/tasks/chromium.yml
@@ -0,0 +1,12 @@
+---
+# devtools tasks/chromium.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: install chromium browser
+ apt:
+ name: "{{ devtools_chromium_apt }}"
+ state: present
+ update_cache: true
+ cache_valid_time: 3600
diff --git a/tasks/java11.yml b/tasks/java11.yml
new file mode 100644
index 0000000..76e17f7
--- /dev/null
+++ b/tasks/java11.yml
@@ -0,0 +1,14 @@
+---
+# devtools tasks/java.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+#
+- name: install Java 11 dev tools (only needed on physical/VM)
+ apt:
+ name:
+ - maven
+ - openjdk-11-jdk-headless
+ state: present
+ update_cache: true
+ cache_valid_time: 3600
diff --git a/tasks/k8s.yml b/tasks/k8s.yml
new file mode 100644
index 0000000..d9e1cc5
--- /dev/null
+++ b/tasks/k8s.yml
@@ -0,0 +1,101 @@
+---
+# devtools tasks/k8s.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+
+# kubectl
+- name: Download/install kubectl binary
+ get_url:
+ url: "{{ devtools_kubectl_url }}"
+ checksum: "{{ devtools_kubectl_checksum }}"
+ dest: /usr/local/bin/kubectl
+ mode: "0755"
+
+# kind
+- name: Download/install kind binary
+ get_url:
+ url: "{{ devtools_kind_url }}"
+ checksum: "{{ devtools_kind_checksum }}"
+ dest: /usr/local/bin/kind
+ mode: "0755"
+
+# helm
+- name: Download helm archive
+ get_url:
+ url: "{{ devtools_helm_url }}"
+ checksum: "{{ devtools_helm_checksum }}"
+ dest: "/tmp/helm.tgz"
+
+- name: Unarchive helm
+ unarchive:
+ src: "/tmp/helm.tgz"
+ dest: "/tmp"
+ remote_src: true
+
+- name: Install helm binary
+ copy:
+ src: /tmp/linux-amd64/helm
+ dest: /usr/local/bin/helm
+ mode: "0755"
+ remote_src: true
+
+# kubeval
+- name: Download kubeval archive
+ get_url:
+ url: "{{ devtools_kubeval_url }}"
+ checksum: "{{ devtools_kubeval_checksum }}"
+ dest: "/tmp/kubeval.tgz"
+
+- name: Unarchive kubeval
+ unarchive:
+ src: "/tmp/kubeval.tgz"
+ dest: "/tmp"
+ remote_src: true
+
+- name: Install kubeval binary
+ copy:
+ src: /tmp/kubeval
+ dest: /usr/local/bin/kubeval
+ mode: "0755"
+ remote_src: true
+
+# conftest
+- name: Download conftest archive
+ get_url:
+ url: "{{ devtools_conftest_url }}"
+ checksum: "{{ devtools_conftest_checksum }}"
+ dest: "/tmp/conftest.tgz"
+
+- name: Unarchive conftest
+ unarchive:
+ src: "/tmp/conftest.tgz"
+ dest: "/tmp"
+ remote_src: true
+
+- name: Install conftest binary
+ copy:
+ src: /tmp/conftest
+ dest: /usr/local/bin/conftest
+ mode: "0755"
+ remote_src: true
+
+# fleet
+- name: Download/install fleet binary
+ get_url:
+ url: "{{ devtools_fleet_url }}"
+ checksum: "{{ devtools_fleet_checksum }}"
+ dest: /usr/local/bin/fleet
+ mode: "0755"
+
+# cleanup
+- name: Cleanup k8s downloads in /tmp
+ file:
+ path: "/tmp/{{ item }}"
+ state: absent
+ with_items:
+ - linux-amd64
+ - helm.tgz
+ - kubeval.tgz
+ - conftest.tgz
diff --git a/tasks/main.yml b/tasks/main.yml
new file mode 100644
index 0000000..f4fe901
--- /dev/null
+++ b/tasks/main.yml
@@ -0,0 +1,44 @@
+---
+# devtools tasks/main.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: include OS-specific vars
+ include_vars: "{{ ansible_os_family }}.yml"
+
+- name: include OS-specific tasks
+ include_tasks: "{{ ansible_os_family }}.yml"
+
+# repo
+- name: Download repo launcher
+ get_url:
+ url: "{{ devtools_repo_url }}"
+ checksum: "{{ devtools_repo_checksum }}"
+ dest: /tmp/repo.b64
+
+- name: Decode, fix shebang, and make repo launcher executable
+ shell:
+ cmd: |
+ base64 --decode /tmp/repo.b64 > /tmp/repo
+ # force repo launcher to use python3 - not needed if python-is-python3 installed
+ sed -i.bak 's"#!/usr/bin/env python"#!/usr/bin/env python3"' /tmp/repo
+ cp /tmp/repo /usr/local/bin/repo
+ chmod 755 /usr/local/bin/repo
+ creates: /usr/local/bin/repo
+
+# cleanup
+- name: Clean up downloads in /tmp
+ file:
+ path: "/tmp/{{ item }}"
+ state: absent
+ with_items:
+ - repo.b64
+ - repo.bak
+ - repo
+
+- name: Install additional devtools
+ include_tasks: "{{ dt_inst_item }}.yml"
+ loop: "{{ devtools_install | flatten(levels=1) }}"
+ loop_control:
+ loop_var: dt_inst_item
diff --git a/tasks/python2.yml b/tasks/python2.yml
new file mode 100644
index 0000000..2b275e6
--- /dev/null
+++ b/tasks/python2.yml
@@ -0,0 +1,11 @@
+---
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <info@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: Install python2 (deprecated)
+ apt:
+ name:
+ - python2
+ state: present
+ update_cache: true
+ cache_valid_time: 3600
diff --git a/tasks/shellcheck.yml b/tasks/shellcheck.yml
new file mode 100644
index 0000000..deeb6d0
--- /dev/null
+++ b/tasks/shellcheck.yml
@@ -0,0 +1,33 @@
+---
+# devtools tasks/shellcheck.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: Download shellcheck archive
+ get_url:
+ url: "{{ devtools_shellcheck_url }}"
+ checksum: "{{ devtools_shellcheck_checksum }}"
+ dest: "/tmp/shellcheck.tar.xz"
+
+- name: Unarchive shellcheck
+ unarchive:
+ src: "/tmp/shellcheck.tar.xz"
+ dest: "/tmp"
+ remote_src: true
+
+- name: Install shellcheck binary
+ copy:
+ src: "/tmp/shellcheck-v{{ devtools_shellcheck_version }}/shellcheck"
+ dest: /usr/local/bin/shellcheck
+ mode: "0755"
+ remote_src: true
+
+# cleanup
+- name: Cleanup shellcheck downloads in /tmp
+ file:
+ path: "/tmp/{{ item }}"
+ state: absent
+ with_items:
+ - shellcheck.tar.xz
+ - "shellcheck-v{{ devtools_shellcheck_version }}"
diff --git a/tasks/terraform.yml b/tasks/terraform.yml
new file mode 100644
index 0000000..11bb240
--- /dev/null
+++ b/tasks/terraform.yml
@@ -0,0 +1,41 @@
+---
+# devtools tasks/terraform.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+# terraform
+- name: Download terraform archive
+ get_url:
+ url: "{{ devtools_terraform_url }}"
+ checksum: "{{ devtools_terraform_checksum }}"
+ dest: "/tmp/terraform.zip"
+
+- name: Unarchive terraform
+ unarchive:
+ src: "/tmp/terraform.zip"
+ dest: "/tmp"
+ remote_src: true
+
+- name: Install terraform binary
+ copy:
+ src: /tmp/terraform
+ dest: /usr/local/bin/terraform
+ mode: "0755"
+ remote_src: true
+
+# tfmask
+- name: Download/install tfmask binary
+ get_url:
+ url: "{{ devtools_tfmask_url }}"
+ checksum: "{{ devtools_tfmask_checksum }}"
+ dest: /usr/local/bin/tfmask
+ mode: "0755"
+
+# cleanup
+- name: Cleanup terraform downloads in /tmp
+ file:
+ path: "/tmp/{{ item }}"
+ state: absent
+ with_items:
+ - terraform.zip
diff --git a/tasks/vagrant.yml b/tasks/vagrant.yml
new file mode 100644
index 0000000..9de01ed
--- /dev/null
+++ b/tasks/vagrant.yml
@@ -0,0 +1,14 @@
+---
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <info@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+# Vagrant/virtualbox (note: Debian and variants specific)
+
+- name: Add Vagrant/Virtualbox using apt
+ apt:
+ name:
+ - vagrant
+ - virtualbox
+ state: present
+ update_cache: true
+ cache_valid_time: 3600
diff --git a/tasks/yq.yml b/tasks/yq.yml
new file mode 100644
index 0000000..3272d8c
--- /dev/null
+++ b/tasks/yq.yml
@@ -0,0 +1,13 @@
+---
+# devtools tasks/yq.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+# yq
+- name: Download/install yq binary
+ get_url:
+ url: "{{ devtools_yq_url }}"
+ checksum: "{{ devtools_yq_checksum }}"
+ dest: /usr/local/bin/yq
+ mode: "0755"
diff --git a/vars/Debian.yml b/vars/Debian.yml
new file mode 100644
index 0000000..7965c39
--- /dev/null
+++ b/vars/Debian.yml
@@ -0,0 +1,11 @@
+---
+# devtools vars/Debian.yml
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+#
+# NOTE: Only put platform/OS-specific variables in this file.
+# Put all other variables in the 'defaults/main.yml' file.
+
+devtools_chromium_apt:
+ - "chromium-shell"