-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c92cca
commit e3d2f38
Showing
12 changed files
with
1,437 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,3 +117,5 @@ node_modules/ | |
**/.vitepress/dist | ||
|
||
**TODO* | ||
|
||
*export.json* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
- name: Get Vaultwarden server version | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
vaultwarden_server: '{{ VAULTWARDEN_SERVER }}' # Replace with actual server or pass as extra var | ||
|
||
username: "{{ USERNAME }}" # Set via external variables or replace | ||
password: "{{ PASSWORD }}" # Set via external variables or replace | ||
vaultwarden_export_json: "{{ VAULTWARDEN_EXPORT_JSON }}" # Path for exported JSON | ||
|
||
tasks: | ||
- name: Fetch Vaultwarden config | ||
ansible.builtin.uri: | ||
url: '{{ vaultwarden_server }}/api/config' | ||
return_content: true | ||
status_code: 200 | ||
register: response | ||
failed_when: response.status != 200 | ||
|
||
- name: Parse and extract server version | ||
ansible.builtin.set_fact: | ||
server_version: "{{ response.json | json_query('server.version') }}" | ||
|
||
- name: Debug output | ||
ansible.builtin.debug: | ||
var: server_version | ||
|
||
- name: Set Bitwarden server | ||
ansible.builtin.command: | ||
cmd: bw config server "{{ vaultwarden_server }}" | ||
|
||
- name: Log in to Bitwarden and export session token | ||
ansible.builtin.command: | ||
cmd: bw login "{{ username }}" "{{ password }}" --raw | ||
register: bw_session | ||
changed_when: false | ||
|
||
- name: Export session token to environment variable | ||
ansible.builtin.set_fact: | ||
BW_SESSION: "{{ bw_session.stdout }}" | ||
|
||
- name: Sync Bitwarden data | ||
ansible.builtin.command: | ||
cmd: bw sync | ||
environment: | ||
BW_SESSION: "{{ BW_SESSION }}" | ||
|
||
- name: Export Vaultwarden data in JSON format | ||
ansible.builtin.command: | ||
cmd: bw export --format json --output "{{ vaultwarden_export_json }}" | ||
environment: | ||
BW_SESSION: "{{ BW_SESSION }}" | ||
|
||
- name: Log out from Vaultwarden | ||
ansible.builtin.command: | ||
cmd: bw logout | ||
environment: | ||
BW_SESSION: "{{ BW_SESSION }}" | ||
|
||
- name: Validate JSON content using Ansible's built-in filter | ||
ansible.builtin.slurp: | ||
path: "{{ vaultwarden_export_json }}" | ||
register: json_file_content | ||
|
||
- name: Parse and validate JSON | ||
set_fact: | ||
parsed_json: "{{ json_file_content.content | b64decode | from_json }}" | ||
failed_when: parsed_json is not defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
- name: Get Vaultwarden server version | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
vaultwarden_server: '{{ VAULTWARDEN_SERVER }}' # Replace with actual server or pass as extra var | ||
|
||
username: "{{ USERNAME }}" # Set via external variables or replace | ||
password: "{{ PASSWORD }}" # Set via external variables or replace | ||
vaultwarden_export_json: "{{ VAULTWARDEN_EXPORT_JSON }}" # Path for exported JSON | ||
|
||
tasks: | ||
- name: Fetch Vaultwarden config | ||
ansible.builtin.uri: | ||
url: '{{ vaultwarden_server }}/api/config' | ||
return_content: true | ||
status_code: 200 | ||
register: response | ||
failed_when: response.status != 200 | ||
|
||
- name: Parse and extract server version | ||
ansible.builtin.set_fact: | ||
server_version: "{{ response.json | json_query('server.version') }}" | ||
|
||
- name: Debug output | ||
ansible.builtin.debug: | ||
var: server_version | ||
|
||
- name: Set Bitwarden server | ||
ansible.builtin.command: | ||
cmd: bw config server "{{ vaultwarden_server }}" | ||
|
||
- name: Log in to Bitwarden and export session token | ||
ansible.builtin.command: | ||
cmd: bw login "{{ username }}" "{{ password }}" --raw | ||
register: bw_session | ||
changed_when: false | ||
|
||
- name: Export session token to environment variable | ||
ansible.builtin.set_fact: | ||
BW_SESSION: "{{ bw_session.stdout }}" | ||
|
||
- name: Sync Bitwarden data | ||
ansible.builtin.command: | ||
cmd: bw sync | ||
environment: | ||
BW_SESSION: "{{ BW_SESSION }}" | ||
|
||
- name: Export Vaultwarden data in JSON format | ||
ansible.builtin.command: | ||
cmd: bw export --format json --output "{{ vaultwarden_export_json }}" | ||
environment: | ||
BW_SESSION: "{{ BW_SESSION }}" | ||
|
||
- name: Log out from Vaultwarden | ||
ansible.builtin.command: | ||
cmd: bw logout | ||
environment: | ||
BW_SESSION: "{{ BW_SESSION }}" | ||
|
||
- name: Validate JSON content using Ansible's built-in filter | ||
ansible.builtin.slurp: | ||
path: "{{ vaultwarden_export_json }}" | ||
register: json_file_content | ||
|
||
- name: Parse and validate JSON | ||
set_fact: | ||
parsed_json: "{{ json_file_content.content | b64decode | from_json }}" | ||
failed_when: parsed_json is not defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
- name: Get Vaultwarden server version | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
vaultwarden_server: '{{ VAULTWARDEN_SERVER }}' # Replace with actual server or pass as extra var | ||
|
||
tasks: | ||
- name: Fetch Vaultwarden config | ||
ansible.builtin.uri: | ||
url: '{{ vaultwarden_server }}/api/config' | ||
return_content: true | ||
status_code: 200 | ||
register: response | ||
failed_when: response.status != 200 | ||
|
||
- name: Parse and extract server version | ||
ansible.builtin.set_fact: | ||
server_version: "{{ response.json | json_query('server.version') }}" | ||
|
||
- name: Debug output | ||
ansible.builtin.debug: | ||
var: server_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- name: Get Vaultwarden server version | ||
import_playbook: get-vaultwarden-version.yaml | ||
|
||
- name: Export Vaultwarden | ||
import_playbook: export-vaultwarden.yaml | ||
|
||
- hosts: localhost | ||
gather_facts: no | ||
tasks: | ||
- name: Capture output from Playbook 1 | ||
set_fact: | ||
server_version: "{{ server_version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Playbook 2 - Use output from Playbook 1 | ||
hosts: localhost | ||
gather_facts: no | ||
vars: | ||
number_from_playbook1: "" | ||
tasks: | ||
- name: Use the random number passed from Playbook 1 | ||
debug: | ||
msg: "Using the number from Playbook 1: {{ number_from_playbook1 }}" | ||
|
||
- name: Perform a task using the passed number (Simulated task) | ||
ansible.builtin.command: "echo Processing number {{ number_from_playbook1 }}" | ||
register: processed_output | ||
|
||
- name: Display processed output | ||
debug: | ||
msg: "Processed output is: {{ processed_output.stdout }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,72 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { withMermaid } from "vitepress-plugin-mermaid"; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
title: "Rocket Cloud", | ||
description: "Documentation", | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
nav: [ | ||
{ text: 'Home', link: '/' }, | ||
{ text: 'Getting started', link: '/getting-started' } | ||
], | ||
|
||
sidebar: [ | ||
{ | ||
text: 'How it works', | ||
items: [ | ||
{ text: 'Concepts', link: '/how-it-works' }, | ||
] | ||
}, | ||
{ | ||
text: 'Getting started', | ||
items: [ | ||
] | ||
}, | ||
{ | ||
text: 'Development', | ||
items: [ | ||
{ text: 'Principles & Guidelines', link: '/principles-and-guidelines' }, | ||
] | ||
}, | ||
{ | ||
text: 'Applicaitons & Services', | ||
items: [ | ||
{ text: 'Docs (vitepress)', link: '/apps/docs' }, | ||
{ text: 'Homer', link: '/apps/homer' }, | ||
{ text: 'Status (upptime)', link: '/apps/status' }, | ||
{ text: 'Vault', link: '/apps/vault' }, | ||
{ text: 'Vaultwarden', link: '/apps/vaultwarden' }, | ||
] | ||
}, | ||
{ | ||
text: '', | ||
items: [ | ||
{ text: 'Server rack', link: '/rack' }, | ||
{ text: 'Evolution of the homelab', link: '/evolution' }, | ||
] | ||
}, | ||
{ | ||
text: 'Examples', | ||
items: [ | ||
{ text: 'Markdown Examples', link: '/markdown-examples' }, | ||
{ text: 'Runtime API Examples', link: '/api-examples' } | ||
] | ||
} | ||
], | ||
export default withMermaid( | ||
defineConfig({ | ||
title: "Rocket Cloud", | ||
description: "Documentation", | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
nav: [ | ||
{ text: 'Home', link: '/' }, | ||
{ text: 'Getting started', link: '/getting-started' } | ||
], | ||
|
||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/tryrocket-cloud/home-ops' } | ||
] | ||
} | ||
}) | ||
sidebar: [ | ||
{ | ||
text: 'How it works', | ||
items: [ | ||
{ text: 'Concepts', link: '/how-it-works' }, | ||
] | ||
}, | ||
{ | ||
text: 'Getting started', | ||
items: [ | ||
] | ||
}, | ||
{ | ||
text: 'Development', | ||
items: [ | ||
{ text: 'Principles & Guidelines', link: '/principles-and-guidelines' }, | ||
] | ||
}, | ||
{ | ||
text: 'Applicaitons & Services', | ||
items: [ | ||
{ text: 'Docs (vitepress)', link: '/apps/docs' }, | ||
{ text: 'Homer', link: '/apps/homer' }, | ||
{ text: 'Status (upptime)', link: '/apps/status' }, | ||
{ text: 'Vault', link: '/apps/vault' }, | ||
{ text: 'Vaultwarden', link: '/apps/vaultwarden' }, | ||
] | ||
}, | ||
{ | ||
text: 'Administarion', | ||
items: [ | ||
{ text: 'Backup', link: 'backup-general' }, | ||
] | ||
}, | ||
{ | ||
text: '', | ||
items: [ | ||
{ text: 'Server rack', link: '/rack' }, | ||
{ text: 'Evolution of the homelab', link: '/evolution' }, | ||
] | ||
}, | ||
{ | ||
text: 'Examples', | ||
items: [ | ||
{ text: 'Markdown Examples', link: '/markdown-examples' }, | ||
{ text: 'Runtime API Examples', link: '/api-examples' } | ||
] | ||
} | ||
], | ||
|
||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/tryrocket-cloud/home-ops' } | ||
] | ||
} | ||
}) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,10 @@ outline: deep | |
# Vault | ||
|
||
https://vault.tryrocket.cloud | ||
|
||
Type: `critical` | ||
|
||
Backups: | ||
|
||
- export | ||
- data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.