-
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.
Merge pull request #5 from huntdatacenter/dev
updates
- Loading branch information
Showing
20 changed files
with
682 additions
and
123 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
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
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 @@ | ||
[defaults] |
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 @@ | ||
* * * * * root /usr/bin/true |
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,19 @@ | ||
machines: | ||
'0': | ||
series: noble | ||
relations: | ||
- - ubuntu:juju-info | ||
- cmatrix:juju-info | ||
series: noble | ||
applications: | ||
ubuntu: | ||
charm: huntdatacenter-ubuntu-lite | ||
num_units: 1 | ||
series: noble | ||
to: | ||
- '0' | ||
cmatrix: | ||
charm: ../ansible.charm | ||
series: noble | ||
options: | ||
playbook: "include-file://playbook.yaml" |
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,72 @@ | ||
# Using Ansible charm to add storage | ||
|
||
Find existing storage pool: | ||
```bash | ||
juju list-storage-pools | ||
``` | ||
|
||
Or create a new one: | ||
```bash | ||
juju help create-storage-pool | ||
``` | ||
|
||
```bash | ||
juju deploy ./bundles/storage/bundle.yaml | ||
``` | ||
|
||
Upgrade of charm: | ||
```bash | ||
juju refresh ubuntu-storage --path ./ansible.charm | ||
``` | ||
|
||
Running action to print debug logs from inside ansible: | ||
```bash | ||
juju run ubuntu-storage/leader ansible-playbook diff=1 check=1 tags=debug verbosity=4 | ||
``` | ||
|
||
``` | ||
TASK [Print all extra vars] **************************************************** | ||
ok: [localhost] => { | ||
"hostvars[inventory_hostname]": { | ||
"ansible_check_mode": true, | ||
"ansible_config_file": null, | ||
"ansible_connection": "local", | ||
"ansible_facts": {}, | ||
"ansible_playbook_python": "/usr/bin/python3", | ||
"ansible_remote_tmp": "/root/.ansible/tmp", | ||
"ansible_version": "Unknown", | ||
"app_name": "ubuntu-storage", | ||
"charm_dir": "/var/lib/juju/agents/unit-ubuntu-storage-0/charm", | ||
"crontab": "", | ||
"group_names": [ | ||
"ungrouped" | ||
], | ||
"groups": { | ||
"all": [ | ||
"localhost" | ||
], | ||
"ungrouped": [ | ||
"localhost" | ||
] | ||
}, | ||
"ingress_address": "10.209.9.135", | ||
"inventory_dir": "/etc/ansible", | ||
"inventory_file": "/etc/ansible/hosts", | ||
"inventory_hostname": "localhost", | ||
"inventory_hostname_short": "localhost", | ||
"leader": true, | ||
"local_unit": "ubuntu-storage/0", | ||
"omit": "__omit_place_holder__5f7ea0c7965826acfa7911dcbc4ca9982b7339d4", | ||
"playbook": "- hosts: localhost\n connection: local\n become: true\n gather_facts: false\n\n tasks:\n - name: Run apt update\n ansible.builtin.apt:\n update_cache: true\n become: true\n tags:\n - never\n - install\n - start\n\n - name: Print all available facts\n ansible.builtin.debug:\n var: ansible_facts\n ignore_errors: true\n tags:\n - never\n - install\n - debug\n\n - name: Print all extra vars\n ansible.builtin.debug:\n var: hostvars[inventory_hostname]\n ignore_errors: true\n tags:\n - never\n - install\n - debug\n\n # - name: Install cmatrix\n # ansible.builtin.apt:\n # name:\n # - \"cmatrix\"\n # become: true\n # tags:\n # - never\n # - install\n # - start\n\n # - name: Remove cmatrix\n # ansible.builtin.apt:\n # name:\n # - \"cmatrix\"\n # state: absent\n # become: true\n # tags:\n # - never\n # - stop\n", | ||
"playbook_dir": "/var/lib/juju/agents/unit-ubuntu-storage-0/charm", | ||
"storage_bind_mount": "/opt/charm-ansible/ubuntu-storage/storage", | ||
"storage_mount": "", | ||
"storage_volume": "/var/lib/juju/storage/data/1", | ||
"storages": { | ||
"data": "/var/lib/juju/storage/data/1" | ||
}, | ||
"unit_private_address": "10.209.9.135", | ||
"unit_public_address": "10.209.9.135" | ||
} | ||
} | ||
``` |
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,34 @@ | ||
machines: | ||
'0': | ||
base: ubuntu@24.04 | ||
# series: noble | ||
|
||
default-base: ubuntu@24.04 | ||
# series: noble | ||
|
||
relations: | ||
- - ubuntu:juju-info | ||
- ubuntu-storage:juju-info | ||
|
||
applications: | ||
ubuntu: | ||
charm: huntdatacenter-ubuntu-lite | ||
num_units: 1 | ||
to: | ||
- '0' | ||
ubuntu-storage: | ||
charm: ../../ansible.charm | ||
# juju config ubuntu-storage playbook=@playbook.yaml | ||
options: | ||
playbook: "include-file://playbook.yaml" | ||
# /etc/cron.d/charm_ubuntu_storage | ||
crontab: | | ||
* * * * * root /usr/bin/true | ||
# -- List storage pools to find out whether you will use lxd, cinder, or something else | ||
# | ||
# juju list-storage-pools | ||
# juju help create-storage-pool | ||
storage: | ||
data: lxd,2G | ||
# data: cinder,100G | ||
# -- Mount path will be something like: /var/lib/juju/storage/data/0 |
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,30 @@ | ||
- hosts: localhost | ||
connection: local | ||
become: true | ||
gather_facts: false | ||
|
||
tasks: | ||
- name: Run apt update | ||
ansible.builtin.apt: | ||
update_cache: true | ||
become: true | ||
tags: | ||
- never | ||
- install | ||
- start | ||
|
||
- name: Print all environment variables | ||
ansible.builtin.debug: | ||
var: environment | ||
ignore_errors: true | ||
tags: | ||
- never | ||
- debug | ||
|
||
- name: Print all extra vars | ||
ansible.builtin.debug: | ||
var: hostvars[inventory_hostname] | ||
ignore_errors: true | ||
tags: | ||
- never | ||
- debug |
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
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
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
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,3 +1,3 @@ | ||
from .ansible_playbook import Ansible | ||
|
||
ansible = Ansible() | ||
ansible_manager = Ansible() |
Oops, something went wrong.