Skip to content

Commit

Permalink
added an example file with .vaultifty/settings.json
Browse files Browse the repository at this point in the history
  • Loading branch information
sacha-roussakis-notter committed Feb 5, 2024
1 parent 6a0c892 commit 16eb280
Show file tree
Hide file tree
Showing 4 changed files with 352 additions and 0 deletions.
94 changes: 94 additions & 0 deletions docs/devops/PIPELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,100 @@

This document has been created to showcase, automation solutions that can be used with vaultify.

---

# Azure DevOps

This section shows how you would pass the required environment variables if you want to use vaultify within your self-hosted agents or Microsoft cloud agents.

| Command | Templated Task | Usage |
|-------------|------------------------------------------------|-----------------------------------------------|
| `command1` | [View Template](#install-vaultify) | [View Usage](#usage1) |
| `command2` | [View Template](#template2) | [View Usage](#usage2) |
| `command3` | [View Template](#template3) | [View Usage](#usage3) |


<details>
<summary>Click to view pipeline templated examples</summary>

<br>

## Install Vaultify

`install_vaultify.yml`
```yml
parameters:
defaultWorkingDirectory: ''

steps:

####################
# Install Vaultify #
####################

- task: Bash@3
displayName: "Install > Vaultify"
continueOnError: false
enabled: true
inputs:
targetType: 'inline'
workingDirectory: $(System.DefaultWorkingDirectory)
script: |
if ! [ -x "$(command -v vaultify)" ];
then
echo "⚠️ Installing Vaultify..."
curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/DFW1N/vaultify/main/scripts/install-vaultify.sh | sudo bash
vaultify --version
else
echo "✅ Vaultify is already installed."
vaultify --version
fi
```



---

<br>

`vaultify_retrieve.yml`

```yml
parameters:
defaultWorkingDirectory: ''
vaultToken: ''
vaultServerUrl: ''
subscriptionId: ''
clientId: ''
clientSecretId: ''
tenantId: ''

steps:

####################
# Install Vaultify #
####################

- task: Bash@3
displayName: "Vaultify > Retrieve"
continueOnError: false
enabled: true
inputs:
targetType: 'inline'
workingDirectory: ${{ parameters.defaultWorkingDirectory }}
script: |
vaultify retrieve
env:
VAULT_ADDR: ${{ parameters.vaultServerUrl }}
VAULT_TOKEN: ${{ parameters.vaultToken }}
ARM_SUBSCRIPTION_ID: ${{ parameters.subscriptionId }}
ARM_CLIENT_ID: ${{ parameters.clientId }}
ARM_CLIENT_SECRET: ${{ parameters.clientSecretId }}
ARM_TENANT_ID: ${{ parameters.tenantId }}
```

</details>


## Author

Expand Down
65 changes: 65 additions & 0 deletions docs/devops/template_tasks/EXAMPLE_TEMPLATE_FILE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!-- // ########################################################################################
// # ██████╗ ██╗ ██╗██╗ ██╗███╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗██████╗ #
// # ██╔══██╗██║ ██║██║ ██║████╗ ██║ ██╔════╝ ██╔══██╗██╔═══██╗██║ ██║██╔══██╗ #
// # ██████╔╝██║ ██║██║ ██║██╔██╗ ██║ ██║ ███╗██████╔╝██║ ██║██║ ██║██████╔╝ #
// # ██╔══██╗██║ ██║██║ ██║██║╚██╗██║ ██║ ██║██╔══██╗██║ ██║██║ ██║██╔═══╝ #
// # ██████╔╝╚██████╔╝╚██████╔╝██║ ╚████║ ╚██████╔╝██║ ██║╚██████╔╝╚██████╔╝██║ #
// # ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ #
// # Author: Sacha Roussakis-Notter #
// # Project: Vaultify #
// # Description: Easily push, pull and encrypt tofu and terraform statefiles from Vault. #
// ######################################################################################## -->

```bash
██╗ ██╗ █████╗ ██╗ ██╗██╗ ████████╗██╗███████╗██╗ ██╗
██║ ██║██╔══██╗██║ ██║██║ ╚══██╔══╝██║██╔════╝╚██╗ ██╔╝
██║ ██║███████║██║ ██║██║ ██║ ██║█████╗ ╚████╔╝
╚██╗ ██╔╝██╔══██║██║ ██║██║ ██║ ██║██╔══╝ ╚██╔╝
╚████╔╝ ██║ ██║╚██████╔╝███████╗██║ ██║██║ ██║
╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝

```

# Introduction

This document has been created to showcase, how you can intergrate `Vaultify`, into your pipelines for automation.

---

<br>

# Azure DevOps

This section covers how you create tasks, to automate pipelines with `Vaultify`, it has been broken down into two sections, one being the templated task, what it is actually doing using `bash` and the second part actually using the templated task and passing the required `parameters` to it.

<br>

``
### Part 1, templated task.

```yml

```

> `Note:`
---

### Part 2, template usage.

```yml

```

> `Note:`
---

<br>

## Author

| Vaultify |
| ----------------------- |
| **Sacha Roussakis-Notter** |
| *Maintainer and Creator* |
85 changes: 85 additions & 0 deletions docs/devops/template_tasks/INSTALL_VAULTIFY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!-- // ########################################################################################
// # ██████╗ ██╗ ██╗██╗ ██╗███╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗██████╗ #
// # ██╔══██╗██║ ██║██║ ██║████╗ ██║ ██╔════╝ ██╔══██╗██╔═══██╗██║ ██║██╔══██╗ #
// # ██████╔╝██║ ██║██║ ██║██╔██╗ ██║ ██║ ███╗██████╔╝██║ ██║██║ ██║██████╔╝ #
// # ██╔══██╗██║ ██║██║ ██║██║╚██╗██║ ██║ ██║██╔══██╗██║ ██║██║ ██║██╔═══╝ #
// # ██████╔╝╚██████╔╝╚██████╔╝██║ ╚████║ ╚██████╔╝██║ ██║╚██████╔╝╚██████╔╝██║ #
// # ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ #
// # Author: Sacha Roussakis-Notter #
// # Project: Vaultify #
// # Description: Easily push, pull and encrypt tofu and terraform statefiles from Vault. #
// ######################################################################################## -->

```bash
██╗ ██╗ █████╗ ██╗ ██╗██╗ ████████╗██╗███████╗██╗ ██╗
██║ ██║██╔══██╗██║ ██║██║ ╚══██╔══╝██║██╔════╝╚██╗ ██╔╝
██║ ██║███████║██║ ██║██║ ██║ ██║█████╗ ╚████╔╝
╚██╗ ██╔╝██╔══██║██║ ██║██║ ██║ ██║██╔══╝ ╚██╔╝
╚████╔╝ ██║ ██║╚██████╔╝███████╗██║ ██║██║ ██║
╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝

```

# Introduction

This document has been created to showcase, how you can intergrate `Vaultify`, into your pipelines for automation.

---

# Azure DevOps

This section covers how you create tasks, to automate pipelines with `Vaultify`, it has been broken down into two sections, one being the templated task, what it is actually doing using `bash` and the second part actually using the templated task and passing the required `parameters` to it.

<br>

`install_vaultify.yml`
### Part 1, templated task.

```yml
steps:

####################
# Install Vaultify #
####################

- task: Bash@3
displayName: "Install > Vaultify"
continueOnError: false
enabled: true
inputs:
targetType: 'inline'
workingDirectory: $(System.DefaultWorkingDirectory)
script: |
if ! [ -x "$(command -v vaultify)" ];
then
echo "⚠️ Installing Vaultify..."
curl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/DFW1N/vaultify/main/scripts/install-vaultify.sh | sudo bash
vaultify --version
else
echo "✅ Vaultify is already installed."
vaultify --version
fi
```

---

### Part 2, template usage.

```yml
####################
# Install Vaultify #
####################

- template: <relative-path>/vaultify_install.yml
```

---

<br>

## Author

| Vaultify |
| ----------------------- |
| **Sacha Roussakis-Notter** |
| *Maintainer and Creator* |
108 changes: 108 additions & 0 deletions docs/devops/template_tasks/VAULTIFY_RETRIEVE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!-- // ########################################################################################
// # ██████╗ ██╗ ██╗██╗ ██╗███╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗██████╗ #
// # ██╔══██╗██║ ██║██║ ██║████╗ ██║ ██╔════╝ ██╔══██╗██╔═══██╗██║ ██║██╔══██╗ #
// # ██████╔╝██║ ██║██║ ██║██╔██╗ ██║ ██║ ███╗██████╔╝██║ ██║██║ ██║██████╔╝ #
// # ██╔══██╗██║ ██║██║ ██║██║╚██╗██║ ██║ ██║██╔══██╗██║ ██║██║ ██║██╔═══╝ #
// # ██████╔╝╚██████╔╝╚██████╔╝██║ ╚████║ ╚██████╔╝██║ ██║╚██████╔╝╚██████╔╝██║ #
// # ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ #
// # Author: Sacha Roussakis-Notter #
// # Project: Vaultify #
// # Description: Easily push, pull and encrypt tofu and terraform statefiles from Vault. #
// ######################################################################################## -->

```bash
██╗ ██╗ █████╗ ██╗ ██╗██╗ ████████╗██╗███████╗██╗ ██╗
██║ ██║██╔══██╗██║ ██║██║ ╚══██╔══╝██║██╔════╝╚██╗ ██╔╝
██║ ██║███████║██║ ██║██║ ██║ ██║█████╗ ╚████╔╝
╚██╗ ██╔╝██╔══██║██║ ██║██║ ██║ ██║██╔══╝ ╚██╔╝
╚████╔╝ ██║ ██║╚██████╔╝███████╗██║ ██║██║ ██║
╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
```

# Introduction

This document has been created to showcase, how you can intergrate `Vaultify`, into your pipelines for automation.

---

<br>

# Azure DevOps

This section covers how you create tasks, to automate pipelines with `Vaultify`, it has been broken down into two sections, one being the templated task, what it is actually doing using `bash` and the second part actually using the templated task and passing the required `parameters` to it.

<br>

`vaultify_retrieve.yml`
### Part 1, templated task.

```yml
parameters:
defaultWorkingDirectory: ''
vaultToken: ''
vaultServerUrl: ''
subscriptionId: ''
clientId: ''
clientSecretId: ''
tenantId: ''

steps:

#####################
# Vaultify Retrieve #
#####################

- task: Bash@3
displayName: "Vaultify > Retrieve"
continueOnError: false
enabled: true
inputs:
targetType: 'inline'
workingDirectory: ${{ parameters.defaultWorkingDirectory }}
script: |
vaultify retrieve
env:
VAULT_ADDR: ${{ parameters.vaultServerUrl }}
VAULT_TOKEN: ${{ parameters.vaultToken }}
ARM_SUBSCRIPTION_ID: ${{ parameters.subscriptionId }}
ARM_CLIENT_ID: ${{ parameters.clientId }}
ARM_CLIENT_SECRET: ${{ parameters.clientSecretId }}
ARM_TENANT_ID: ${{ parameters.tenantId }}
```

> `Note:` Save this templated task as a file `vaultify_retrieve.yml`, somewhere in your repository then point the template to the path of this file.
<br>

---

### Part 2, template usage.

```yml
#####################
# Vaultify Retrieve #
#####################

- template: <relative-directory>/vaultify_retrieve.yml
parameters:
defaultWorkingDirectory: ${{ parameters.defaultWorkingDirectory }}
vaultToken: ${{ parameters.vaultToken }}
vaultServerUrl: ${{ parameters.vaultServerUrl }}
clientSecretId: ${{ parameters.clientSecretId }}
subscriptionId: ${{ parameters.subscriptionId }}
tenantId: ${{ parameters.tenantId }}
clientId: ${{ parameters.clientId }}
```

> `Note:` Please make sure, you are passing these parameters, from Azure keyvault or your secret storage manager to pass it securely.
---

<br>

## Author

| Vaultify |
| ----------------------- |
| **Sacha Roussakis-Notter** |
| *Maintainer and Creator* |

0 comments on commit 16eb280

Please sign in to comment.