0
0
mirror of https://github.com/thegeeklab/wp-ansible.git synced 2024-11-21 03:30:39 +00:00

add docs and rework ci syntax (#4)

This commit is contained in:
Robert Kaussow 2023-12-22 10:10:39 +01:00 committed by GitHub
parent 96850a6103
commit 96cf00485a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 480 additions and 82 deletions

2
.dictionary Normal file
View File

@ -0,0 +1,2 @@
Ansible
wp-ansible

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
/dist /dist
/release /release
/wp-ansible* /wp-ansible*
docs/data/data-raw.yaml
coverage.out coverage.out
CHANGELOG.md CHANGELOG.md

View File

@ -6,7 +6,7 @@ when:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
steps: steps:
dryrun: - name: dryrun
image: quay.io/thegeeklab/wp-docker-buildx:2.0.0 image: quay.io/thegeeklab/wp-docker-buildx:2.0.0
settings: settings:
containerfile: Containerfile.multiarch containerfile: Containerfile.multiarch
@ -19,7 +19,7 @@ steps:
when: when:
- event: [pull_request] - event: [pull_request]
publish-dockerhub: - name: publish-dockerhub
group: container group: container
image: quay.io/thegeeklab/wp-docker-buildx:2.0.0 image: quay.io/thegeeklab/wp-docker-buildx:2.0.0
settings: settings:
@ -40,7 +40,7 @@ steps:
branch: branch:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
publish-quay: - name: publish-quay
group: container group: container
image: quay.io/thegeeklab/wp-docker-buildx:2.0.0 image: quay.io/thegeeklab/wp-docker-buildx:2.0.0
settings: settings:

View File

@ -6,18 +6,18 @@ when:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
steps: steps:
build: - name: build
image: docker.io/techknowlogick/xgo:go-1.21.x image: docker.io/techknowlogick/xgo:go-1.21.x
commands: commands:
- ln -s $(pwd) /source - ln -s $(pwd) /source
- make release - make release
executable: - name: executable
image: quay.io/thegeeklab/alpine-tools image: quay.io/thegeeklab/alpine-tools
commands: commands:
- $(find dist/ -executable -type f -iname ${CI_REPO_NAME}-linux-amd64) --help - $(find dist/ -executable -type f -iname ${CI_REPO_NAME}-linux-amd64) --help
changelog: - name: changelog
image: quay.io/thegeeklab/git-sv image: quay.io/thegeeklab/git-sv
commands: commands:
- git fetch --depth=2147483647 - git fetch --depth=2147483647
@ -25,7 +25,7 @@ steps:
- git sv release-notes -t ${CI_COMMIT_TAG:-next} -o CHANGELOG.md - git sv release-notes -t ${CI_COMMIT_TAG:-next} -o CHANGELOG.md
- cat CHANGELOG.md - cat CHANGELOG.md
publish-github: - name: publish-github
image: docker.io/plugins/github-release image: docker.io/plugins/github-release
settings: settings:
api_key: api_key:
@ -36,7 +36,7 @@ steps:
overwrite: true overwrite: true
title: ${CI_COMMIT_TAG} title: ${CI_COMMIT_TAG}
when: when:
- event: [tag] - event: [tag]
depends_on: depends_on:
- test - test

View File

@ -6,27 +6,27 @@ when:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
steps: steps:
markdownlint: - name: markdownlint
image: quay.io/thegeeklab/markdownlint-cli image: quay.io/thegeeklab/markdownlint-cli
group: test group: test
commands: commands:
- markdownlint 'README.md' 'CONTRIBUTING.md' - markdownlint 'README.md' 'CONTRIBUTING.md'
spellcheck: - name: spellcheck
image: quay.io/thegeeklab/alpine-tools image: quay.io/thegeeklab/alpine-tools
group: test group: test
commands: commands:
- spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls - spellchecker --files 'docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls
environment: environment:
FORCE_COLOR: "true" FORCE_COLOR: "true"
link-validation: - name: link-validation
image: docker.io/lycheeverse/lychee image: docker.io/lycheeverse/lychee
group: test group: test
commands: commands:
- lychee --no-progress --format detailed _docs/content README.md - lychee --no-progress --format detailed docs/content README.md
publish: - name: publish
image: quay.io/thegeeklab/wp-git-action image: quay.io/thegeeklab/wp-git-action
settings: settings:
action: action:
@ -37,13 +37,14 @@ steps:
message: "[skip ci] auto-update documentation" message: "[skip ci] auto-update documentation"
netrc_password: netrc_password:
from_secret: github_token from_secret: github_token
pages_directory: _docs/ pages_directory: docs/
when: when:
- event: [push, manual] - event: [push, manual]
branch: branch:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
status: [success, failure]
pushrm-dockerhub: - name: pushrm-dockerhub
image: docker.io/chko/docker-pushrm:1 image: docker.io/chko/docker-pushrm:1
secrets: secrets:
- source: docker_password - source: docker_password
@ -60,7 +61,7 @@ steps:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
status: [success] status: [success]
pushrm-quay: - name: pushrm-quay
image: docker.io/chko/docker-pushrm:1 image: docker.io/chko/docker-pushrm:1
secrets: secrets:
- source: quay_token - source: quay_token

View File

@ -8,7 +8,7 @@ when:
runs_on: [success, failure] runs_on: [success, failure]
steps: steps:
matrix: - name: matrix
image: quay.io/thegeeklab/wp-matrix image: quay.io/thegeeklab/wp-matrix
settings: settings:
homeserver: homeserver:

View File

@ -6,12 +6,12 @@ when:
- ${CI_REPO_DEFAULT_BRANCH} - ${CI_REPO_DEFAULT_BRANCH}
steps: steps:
lint: - name: lint
image: docker.io/library/golang:1.21 image: docker.io/library/golang:1.21
commands: commands:
- make lint - make lint
test: - name: test
image: docker.io/library/golang:1.21 image: docker.io/library/golang:1.21
commands: commands:
- make test - make test

31
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,31 @@
# Contributing
## Security
If you think you have found a **security issue**, please do not mention it in this repository.
Instead, send an email to `security@thegeeklab.de` with as many details as possible so it can be handled confidential.
## Bug Reports and Feature Requests
If you have found a **bug** or have a **feature request** please use the search first in case a similar issue already exists.
If not, please create an issue in this repository
## Code
If you would like to fix a bug or implement a feature, please fork the repository and create a Pull Request.
Before you start any Pull Request, it is recommended that you create an issue to discuss first if you have any
doubts about requirement or implementation. That way you can be sure that the maintainer(s) agree on what to change and how,
and you can hopefully get a quick merge afterwards.
Pull Requests can only be merged once all status checks are green.
## Do not force push to your Pull Request branch
Please do not force push to your Pull Requests branch after you have created your Pull Request, as doing so makes it harder for us to review your work.
Pull Requests will always be squashed by us when we merge your work. Commit as many times as you need in your Pull Request branch.
## Re-requesting a review
Please do not ping your reviewer(s) by mentioning them in a new comment. Instead, use the re-request review functionality.
Read more about this in the [GitHub docs, Re-requesting a review](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request#re-requesting-a-review).

View File

@ -67,6 +67,10 @@ lint: golangci-lint
generate: generate:
$(GO) generate $(GENERATE) $(GO) generate $(GENERATE)
.PHONY: generate-docs
generate-docs:
$(GO) generate ./cmd/$(EXECUTABLE)/flags.go
.PHONY: test .PHONY: test
test: test:
$(GO) run $(GOTESTSUM_PACKAGE) --no-color=false -- -coverprofile=coverage.out $(PACKAGES) $(GO) run $(GOTESTSUM_PACKAGE) --no-color=false -- -coverprofile=coverage.out $(PACKAGES)

View File

@ -10,7 +10,7 @@ Woodpecker CI plugin to manage infrastructure with Ansible
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-ansible) [![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-ansible)
[![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/wp-ansible)](https://github.com/thegeeklab/wp-ansible/blob/main/LICENSE) [![License: Apache-2.0](https://img.shields.io/github/license/thegeeklab/wp-ansible)](https://github.com/thegeeklab/wp-ansible/blob/main/LICENSE)
Woodpecker CI plugin to manage infrastructure with [Ansible](https://www.ansible.com/). You can find the full documentation at [https://woodpecker-plugins.geekdocs.de](https://woodpecker-plugins.geekdocs.de/plugins/wp-ansible). Woodpecker CI plugin to manage infrastructure with [Ansible](https://github.com/ansible/ansible). You can find the full documentation at [https://woodpecker-plugins.geekdocs.de](https://woodpecker-plugins.geekdocs.de/plugins/wp-ansible).
## Contributors ## Contributors

57
cmd/wp-ansible/docs.go Normal file
View File

@ -0,0 +1,57 @@
//go:build generate
// +build generate
package main
import (
"bytes"
"embed"
"fmt"
"os"
"text/template"
"github.com/thegeeklab/wp-ansible/plugin"
"github.com/thegeeklab/wp-plugin-go/docs"
wp "github.com/thegeeklab/wp-plugin-go/plugin"
"github.com/urfave/cli/v2"
)
//go:embed templates/docs-data.yaml.tmpl
var yamlTemplate embed.FS
func main() {
settings := &plugin.Settings{}
app := &cli.App{
Flags: settingsFlags(settings, wp.FlagsPluginCategory),
}
out, err := toYAML(app)
if err != nil {
panic(err)
}
fi, err := os.Create("../../docs/data/data-raw.yaml")
if err != nil {
panic(err)
}
defer fi.Close()
if _, err := fi.WriteString(out); err != nil {
panic(err)
}
}
func toYAML(app *cli.App) (string, error) {
var w bytes.Buffer
yamlTmpl, err := template.New("docs").ParseFS(yamlTemplate, "templates/docs-data.yaml.tmpl")
if err != nil {
fmt.Println(yamlTmpl)
return "", err
}
if err := yamlTmpl.ExecuteTemplate(&w, "docs-data.yaml.tmpl", docs.GetTemplateData(app)); err != nil {
return "", err
}
return w.String(), nil
}

View File

@ -5,26 +5,28 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
// settingsFlags has the cli.Flags for the plugin.Settings. // SettingsFlags has the cli.Flags for the plugin.Settings.
//
//go:generate go run docs.go flags.go
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag { func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "requirements", Name: "python-requirements",
Usage: "path to python requirements", Usage: "path to python requirements file",
EnvVars: []string{"PLUGIN_REQUIREMENTS"}, EnvVars: []string{"PLUGIN_PYTHON_REQUIREMENTS"},
Destination: &settings.Requirements, Destination: &settings.PythonRequirements,
Category: category, Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "galaxy", Name: "galaxy-requirements",
Usage: "path to galaxy requirements", Usage: "path to galaxy requirements file",
EnvVars: []string{"PLUGIN_GALAXY"}, EnvVars: []string{"PLUGIN_GALAXY_REQUIREMENTS"},
Destination: &settings.Galaxy, Destination: &settings.GalaxyRequirements,
Category: category, Category: category,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "inventory", Name: "inventory",
Usage: "specify inventory host path", Usage: "path to inventory file",
EnvVars: []string{"PLUGIN_INVENTORY", "PLUGIN_INVENTORIES"}, EnvVars: []string{"PLUGIN_INVENTORY", "PLUGIN_INVENTORIES"},
Destination: &settings.Inventories, Destination: &settings.Inventories,
Category: category, Category: category,
@ -38,7 +40,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "limit", Name: "limit",
Usage: "further limit selected hosts to an additional pattern", Usage: "limit selected hosts to an additional pattern",
EnvVars: []string{"PLUGIN_LIMIT"}, EnvVars: []string{"PLUGIN_LIMIT"},
Destination: &settings.Limit, Destination: &settings.Limit,
Category: category, Category: category,
@ -165,7 +167,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "private-key", Name: "private-key",
Usage: "use this key to authenticate the connection", Usage: "ssh private key used to authenticate the connection",
EnvVars: []string{"PLUGIN_PRIVATE_KEY", "ANSIBLE_PRIVATE_KEY"}, EnvVars: []string{"PLUGIN_PRIVATE_KEY", "ANSIBLE_PRIVATE_KEY"},
Destination: &settings.PrivateKey, Destination: &settings.PrivateKey,
Category: category, Category: category,
@ -193,35 +195,35 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "ssh-common-args", Name: "ssh-common-args",
Usage: "specify common arguments to pass to sftp/scp/ssh", Usage: "specify common arguments to pass to sftp,scp and ssh connections",
EnvVars: []string{"PLUGIN_SSH_COMMON_ARGS"}, EnvVars: []string{"PLUGIN_SSH_COMMON_ARGS"},
Destination: &settings.SSHCommonArgs, Destination: &settings.SSHCommonArgs,
Category: category, Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "sftp-extra-args", Name: "sftp-extra-args",
Usage: "specify extra arguments to pass to sftp only", Usage: "specify extra arguments to pass to sftp connections only",
EnvVars: []string{"PLUGIN_SFTP_EXTRA_ARGS"}, EnvVars: []string{"PLUGIN_SFTP_EXTRA_ARGS"},
Destination: &settings.SFTPExtraArgs, Destination: &settings.SFTPExtraArgs,
Category: category, Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "scp-extra-args", Name: "scp-extra-args",
Usage: "specify extra arguments to pass to scp only", Usage: "specify extra arguments to pass to scp connections only",
EnvVars: []string{"PLUGIN_SCP_EXTRA_ARGS"}, EnvVars: []string{"PLUGIN_SCP_EXTRA_ARGS"},
Destination: &settings.SCPExtraArgs, Destination: &settings.SCPExtraArgs,
Category: category, Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "ssh-extra-args", Name: "ssh-extra-args",
Usage: "specify extra arguments to pass to ssh only", Usage: "specify extra arguments to pass to ssh connections only",
EnvVars: []string{"PLUGIN_SSH_EXTRA_ARGS"}, EnvVars: []string{"PLUGIN_SSH_EXTRA_ARGS"},
Destination: &settings.SSHExtraArgs, Destination: &settings.SSHExtraArgs,
Category: category, Category: category,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "become", Name: "become",
Usage: "run operations with become", Usage: "enable privilege escalation",
EnvVars: []string{"PLUGIN_BECOME"}, EnvVars: []string{"PLUGIN_BECOME"},
Destination: &settings.Become, Destination: &settings.Become,
Category: category, Category: category,
@ -235,7 +237,7 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "become-user", Name: "become-user",
Usage: "run operations as this user", Usage: "privilege escalation user to use",
EnvVars: []string{"PLUGIN_BECOME_USER", "ANSIBLE_BECOME_USER"}, EnvVars: []string{"PLUGIN_BECOME_USER", "ANSIBLE_BECOME_USER"},
Destination: &settings.BecomeUser, Destination: &settings.BecomeUser,
Category: category, Category: category,

View File

@ -0,0 +1,14 @@
---
{{- if .GlobalArgs }}
properties:
{{- range $v := .GlobalArgs }}
- name: {{ $v.Name }}
{{- with $v.Description }}
description: |
{{ . }}
{{- end }}
{{- with $v.Default }}
defaultvalue: {{ . }}
{{- end }}
{{ end -}}
{{ end -}}

63
docs/content/_index.md Normal file
View File

@ -0,0 +1,63 @@
---
title: wp-ansible
---
[![Build Status](https://ci.thegeeklab.de/api/badges/thegeeklab/wp-ansible/status.svg)](https://ci.thegeeklab.de/repos/thegeeklab/wp-ansible)
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/wp-ansible)
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/wp-ansible)
[![Go Report Card](https://goreportcard.com/badge/github.com/thegeeklab/wp-ansible)](https://goreportcard.com/report/github.com/thegeeklab/wp-ansible)
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/wp-ansible)](https://github.com/thegeeklab/wp-ansible/graphs/contributors)
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/wp-ansible)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/wp-ansible)](https://github.com/thegeeklab/wp-ansible/blob/main/LICENSE)
Woodpecker CI plugin to manage infrastructure with [Ansible](https://github.com/ansible/ansible).
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< toc >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
## Usage
```YAML
kind: pipeline
name: default
steps:
- name: ansible
image: thegeeklab/drone-ansible
settings:
playbook: deployment/playbook.yml
private_key:
from_secret: ansible_private_key
inventory: deployment/hosts.yml
```
### Parameters
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< propertylist name=wp-ansible.data sort=name >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
## Build
Build the binary with the following command:
```Shell
make build
```
Build the Container image with the following command:
```Shell
docker build --file Containerfile.multiarch --tag thegeeklab/wp-ansible .
```
## Test
```Shell
```

145
docs/data/data.yaml Normal file
View File

@ -0,0 +1,145 @@
---
properties:
- name: become
description: |
Enable privilege escalation.
defaultvalue: false
- name: become_method
description: |
Privilege escalation method to use.
- name: become_user
description: |
Privilege escalation user to use.
- name: check
description: |
Run a check, do not apply any changes.
defaultvalue: false
- name: connection
description: |
Connection type to use.
- name: diff
description: |
Show the differences. Be careful when using it in public CI environments as it can print secrets.
defaultvalue: false
- name: extra_vars
description: |
Set additional variables as `key=value`.
- name: flush_cache
description: |
Clear the fact cache for every host in inventory.
defaultvalue: false
- name: force_handlers
description: |
Run handlers even if a task fails.
defaultvalue: false
- name: forks
description: |
Specify number of parallel processes to use.
defaultvalue: 5
- name: galaxy_requirements
description: |
Path to galaxy requirements file.
- name: inventory
description: |
Path to inventory file.
- name: limit
description: |
Limit selected hosts to an additional pattern.
- name: list_hosts
description: |
Outputs a list of matching hosts.
defaultvalue: false
- name: list_tags
description: |
List all available tags.
defaultvalue: false
- name: list_tasks
description: |
List all tasks that would be executed.
defaultvalue: false
- name: module_path
description: |
Prepend paths to module library.
- name: playbook
description: |
List of playbooks to apply.
- name: private_key
description: |
SSH private key used to authenticate the connection.
- name: python_requirements
description: |
Path to python requirements file.
- name: scp_extra_args
description: |
Specify extra arguments to pass to SCP connections only.
- name: sftp_extra_args
description: |
Specify extra arguments to pass to SFTP connections only.
- name: skip_tags
description: |
Only run plays and tasks whose tags do not match.
- name: ssh_common_args
description: |
Specify common arguments to pass to SFTP, SCP and SSH connections.
- name: ssh_extra_args
description: |
Specify extra arguments to pass to ssh connections only.
- name: start_at_task
description: |
Start the playbook at the task matching this name.
- name: syntax_check
description: |
Perform a syntax check on the playbook.
defaultvalue: false
- name: tags
description: |
Only run plays and tasks tagged with these values.
- name: timeout
description: |
Override the connection timeout in seconds.
defaultvalue: 0
- name: user
description: |
Connect as this user.
- name: vault_id
description: |
The vault identity to use.
- name: vault_password
description: |
The vault password to use.
- name: verbose
description: |
Level of verbosity, 0 up to 4.
defaultvalue: 0

11
go.mod
View File

@ -9,12 +9,23 @@ require (
) )
require ( require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/joho/godotenv v1.5.1 // indirect github.com/joho/godotenv v1.5.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/rs/zerolog v1.31.0 // indirect github.com/rs/zerolog v1.31.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect golang.org/x/net v0.19.0 // indirect
) )

67
go.sum
View File

@ -1,7 +1,23 @@
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
@ -10,22 +26,73 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A=
github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/thegeeklab/wp-plugin-go v1.3.0 h1:Yhz0dTDwXcbeaoyoPOXNDf2RzSoUixHuE+ML27cYy2E= github.com/thegeeklab/wp-plugin-go v1.3.0 h1:Yhz0dTDwXcbeaoyoPOXNDf2RzSoUixHuE+ML27cYy2E=
github.com/thegeeklab/wp-plugin-go v1.3.0/go.mod h1:EUOH6XJ8G/bcd6gmM6a6vLeta+keyX9ul1Es0F0r2Lc= github.com/thegeeklab/wp-plugin-go v1.3.0/go.mod h1:EUOH6XJ8G/bcd6gmM6a6vLeta+keyX9ul1Es0F0r2Lc=
github.com/urfave/cli/v2 v2.26.0 h1:3f3AMg3HpThFNT4I++TKOejZO8yU55t3JnnSr4S4QEI= github.com/urfave/cli/v2 v2.26.0 h1:3f3AMg3HpThFNT4I++TKOejZO8yU55t3JnnSr4S4QEI=
github.com/urfave/cli/v2 v2.26.0/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/urfave/cli/v2 v2.26.0/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e h1:+SOyEddqYF09QP7vr7CgJ1eti3pY9Fn3LHO1M1r/0sI= github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e h1:+SOyEddqYF09QP7vr7CgJ1eti3pY9Fn3LHO1M1r/0sI=
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -117,12 +117,12 @@ func (p *Plugin) versionCommand() *execabs.Cmd {
) )
} }
func (p *Plugin) requirementsCommand() *execabs.Cmd { func (p *Plugin) pythonRequirementsCommand() *execabs.Cmd {
args := []string{ args := []string{
"install", "install",
"--upgrade", "--upgrade",
"--requirement", "--requirement",
p.Settings.Requirements, p.Settings.PythonRequirements,
} }
return execabs.Command( return execabs.Command(
@ -131,12 +131,12 @@ func (p *Plugin) requirementsCommand() *execabs.Cmd {
) )
} }
func (p *Plugin) galaxyCommand() *execabs.Cmd { func (p *Plugin) galaxyRequirementsCommand() *execabs.Cmd {
args := []string{ args := []string{
"install", "install",
"--force", "--force",
"--role-file", "--role-file",
p.Settings.Galaxy, p.Settings.GalaxyRequirements,
} }
if p.Settings.Verbose > 0 { if p.Settings.Verbose > 0 {

View File

@ -70,12 +70,12 @@ func (p *Plugin) Execute() error {
p.versionCommand(), p.versionCommand(),
} }
if p.Settings.Requirements != "" { if p.Settings.PythonRequirements != "" {
commands = append(commands, p.requirementsCommand()) commands = append(commands, p.pythonRequirementsCommand())
} }
if p.Settings.Galaxy != "" { if p.Settings.GalaxyRequirements != "" {
commands = append(commands, p.galaxyCommand()) commands = append(commands, p.galaxyRequirementsCommand())
} }
for _, inventory := range p.Settings.Inventories.Value() { for _, inventory := range p.Settings.Inventories.Value() {

View File

@ -13,41 +13,41 @@ type Plugin struct {
// Settings for the Plugin. // Settings for the Plugin.
type Settings struct { type Settings struct {
Requirements string PythonRequirements string
Galaxy string GalaxyRequirements string
Inventories cli.StringSlice Inventories cli.StringSlice
Playbooks cli.StringSlice Playbooks cli.StringSlice
Limit string Limit string
SkipTags string SkipTags string
StartAtTask string StartAtTask string
Tags string Tags string
ExtraVars cli.StringSlice ExtraVars cli.StringSlice
ModulePath cli.StringSlice ModulePath cli.StringSlice
Check bool Check bool
Diff bool Diff bool
FlushCache bool FlushCache bool
ForceHandlers bool ForceHandlers bool
ListHosts bool ListHosts bool
ListTags bool ListTags bool
ListTasks bool ListTasks bool
SyntaxCheck bool SyntaxCheck bool
Forks int Forks int
VaultID string VaultID string
VaultPassword string VaultPassword string
VaultPasswordFile string VaultPasswordFile string
Verbose int Verbose int
PrivateKey string PrivateKey string
PrivateKeyFile string PrivateKeyFile string
User string User string
Connection string Connection string
Timeout int Timeout int
SSHCommonArgs string SSHCommonArgs string
SFTPExtraArgs string SFTPExtraArgs string
SCPExtraArgs string SCPExtraArgs string
SSHExtraArgs string SSHExtraArgs string
Become bool Become bool
BecomeMethod string BecomeMethod string
BecomeUser string BecomeUser string
} }
func New(options wp.Options, settings *Settings) *Plugin { func New(options wp.Options, settings *Settings) *Plugin {