added boiler plate cobra structure

pull/4/head
Cian Hatton 3 years ago
parent 36aace27ef
commit bd1a417bfd

@ -9,7 +9,10 @@
# If a container does not exist, the volume will be still be created. # If a container does not exist, the volume will be still be created.
### ###
# TODO: here instead we can probably iterate through all containers with the backup label. ############################################
# TODO: add a command which lists all the stack, and each stack can list all the containers. From there we can iterate
# through each container in the stack calling restore-volume-tasks.yml and then call create-stack-tasks.yml
############################################
--- ---
- name: Redeploy Portainer and All Volumes - name: Redeploy Portainer and All Volumes
@ -43,12 +46,12 @@
- name: Restore Portainer - name: Restore Portainer
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "portainer"
- name: Restore Linkding - name: Restore Linkding
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "linkding"
- name: Start Linkding Stack - name: Start Linkding Stack
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml
@ -58,7 +61,7 @@
- name: Restore Nginx Proxy Manager - name: Restore Nginx Proxy Manager
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "nginx-proxy-manager"
- name: Start Nginx Proxy Manager - name: Start Nginx Proxy Manager
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml
@ -75,12 +78,11 @@
vars: vars:
stack_name: "vpn-stack" stack_name: "vpn-stack"
# Create Network
- name: Restore MariaDB - name: Restore MariaDB
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "mariadb"
- name: Start MariaDB - name: Start MariaDB
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml
@ -90,7 +92,7 @@
- name: Restore Nextcloud - name: Restore Nextcloud
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "nextcloud"
- name: Start Nextcloud - name: Start Nextcloud
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml
@ -100,7 +102,7 @@
- name: Restore Photoprism - name: Restore Photoprism
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "photoprism"
- name: Start Photoprism - name: Start Photoprism
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml
@ -110,7 +112,7 @@
- name: Restore Plex - name: Restore Plex
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "plex"
- name: Start Plex - name: Start Plex
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml
@ -120,7 +122,7 @@
- name: Restore Mealie - name: Restore Mealie
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "mealie"
- name: Start Mealie - name: Start Mealie
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml
@ -130,7 +132,7 @@
- name: Restore Overseerr - name: Restore Overseerr
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "overseerr"
- name: Start Overseerr - name: Start Overseerr
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml
@ -140,7 +142,7 @@
- name: Restore Uptime Kuma - name: Restore Uptime Kuma
import_tasks: ../tasks/restore-volume-tasks.yml import_tasks: ../tasks/restore-volume-tasks.yml
vars: vars:
container_name: "" container_name: "uptime-kuma"
- name: Start Uptime Kuma - name: Start Uptime Kuma
import_tasks: ../tasks/create-stack-tasks.yml import_tasks: ../tasks/create-stack-tasks.yml

@ -0,0 +1,21 @@
package portainer
import (
"fmt"
"github.com/spf13/cobra"
)
var (
countFlagNumbers int
rangeFlagNumbers []string
)
var NumbersCmd = &cobra.Command{
Use: "numbers",
Short: "Returns random numbers",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("numbers mode")
fmt.Println("--count:", countFlagNumbers)
fmt.Println("--range:", rangeFlagNumbers)
},
}

@ -0,0 +1,26 @@
package cmd
import (
"fmt"
"os"
"github.com/chatton/homelab/cmd/portainer"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(portainer.NumbersCmd)
}
var rootCmd = &cobra.Command{
Use: "randx",
Version: "1.0.1",
Short: "Returns random numbers or letters.",
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}

@ -0,0 +1,10 @@
module github.com/chatton/homelab
go 1.18
require github.com/spf13/cobra v1.5.0
require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)

@ -0,0 +1,10 @@
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

@ -0,0 +1,7 @@
package main
import "github.com/chatton/homelab/cmd"
func main() {
cmd.Execute()
}
Loading…
Cancel
Save