Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring to Ansible Collection #7

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9deca21
New deployment playbook
mkbrechtel Jan 25, 2025
6ffa394
Move inventory files to inventories directory
mkbrechtel Jan 25, 2025
a7b13b9
Move update-packages playbook to new playbooks directory
mkbrechtel Jan 25, 2025
f44e3f5
Move the connection plugin to the right place
mkbrechtel Jan 25, 2025
2b36263
Move data directory placeholder files
mkbrechtel Jan 25, 2025
7b25f31
Add ansible collection files and move files out of the ansible directory
mkbrechtel Jan 25, 2025
291dbb9
Adjust basic paths in the README
mkbrechtel Jan 25, 2025
11e1e81
Adjust tests to new structure
mkbrechtel Jan 25, 2025
478560c
Adjust the zed editor config to new repo structure
mkbrechtel Jan 25, 2025
8b7136c
Switch ansible output to yaml for better readability of verbose outpu…
mkbrechtel Jan 25, 2025
59faaf6
Hacky refactoring script
mkbrechtel Jan 25, 2025
2024b7e
Refactor the netplan playbook to role structure (automated transforma…
mkbrechtel Jan 26, 2025
9ded52a
Refactor the environment playbook to role structure (automated transf…
mkbrechtel Jan 26, 2025
5d9f45c
Refactor the nvme playbook to role structure (automated transformation)
mkbrechtel Jan 26, 2025
67afdd4
Refactor the ceph playbook to role structure
mkbrechtel Jan 26, 2025
f259576
Refactor the lvmcluster playbook to role structure (automated transfo…
mkbrechtel Jan 26, 2025
462aa8d
Refactor the ovn playbook to role structure (automated transformation)
mkbrechtel Jan 26, 2025
18fa763
Refactor the incus playbook to role structure
mkbrechtel Jan 26, 2025
ce9cfb0
Place the README into the separate role folders
mkbrechtel Jan 26, 2025
75456bf
Remove the refactoring script
mkbrechtel Jan 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,23 @@ jobs:

- name: Deploy the test VMs
run: |
cd ansible
if [ "${{ matrix.os }}" = "centos/9-Stream" ]; then
cp hosts.yaml.example.centos hosts.yaml
inventory_file=inventories/baremetal-centos.yaml
else
cp hosts.yaml.example hosts.yaml
inventory_file=inventories/baremetal.yaml
fi

ansible-playbook tasks/update-packages.yaml
ansible-playbook -i $inventory_file playbooks/update_packages.yaml

if [ "${{ matrix.os }}" = "ubuntu/20.04" ]; then
# Ubuntu 20.04's OVN is too old.
sed -i "s/ovn_release:.*/ovn_release: \"ppa\"/g" hosts.yaml
sed -i "s/ovn_release:.*/ovn_release: \"ppa\"/g" $inventory_file
elif [ "${{ matrix.os }}" = "debian/12" ]; then
# ZFS on Debian needs compiling which is slow, use btrfs instead
sed -i "s/driver: zfs/driver: btrfs/g" hosts.yaml
sed -i "s/driver: zfs/driver: btrfs/g" $inventory_file
fi

ansible-playbook deploy.yaml
ansible-playbook -i $inventory_file -v deploy.yaml

- name: Post deployment validation
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
__pycache__
data/*
4 changes: 2 additions & 2 deletions .zed/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"shell": "system"
}, {
"label": "Deploy dev cluster",
"command": "ansible-playbook deploy.yaml",
"cwd": "$ZED_WORKTREE_ROOT/ansible",
"command": "ansible-playbook -i inventories/baremetal.yaml deploy.yaml",
"cwd": "$ZED_WORKTREE_ROOT",
"shell": "system"
}
]
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ tofu apply -target=module.baremetal
```

### Run the Ansible Playbook
Go to the ansible directory:
Go to the repository root directory:
```
cd ../ansible/
cd ../
```

NOTE: If you need the same version of Ansible this was tested with:
Expand All @@ -47,15 +47,11 @@ pipenv shell
ansible-galaxy install -r ansible_requirements.yml
```

Copy the example inventory file:
```
cp hosts.yaml.example hosts.yaml
```
NOTE: If you are connecting to a remote Incus host you will need to change the `ansible_incus_remote` variable to match the name of the Incus remote (see: `incus remote list` for a list of remote names to use).

Run the Playbooks:
```
ansible-playbook deploy.yaml
ansible-playbook -i inventories/baremetal.yaml deploy.yaml
```

NOTE: When re-deploying the same cluster (e.g. following a `terraform destroy`),
Expand All @@ -65,9 +61,9 @@ connection to the previously deployed systems which will cause the
deployment to get stuck.

```
rm ansible/data/ceph/*
rm ansible/data/lvmcluster/*
rm ansible/data/ovn/*
rm data/ceph/*
rm data/lvmcluster/*
rm data/ovn/*
```

### Test a VM and Container on the new Incus cluster
Expand Down
3 changes: 2 additions & 1 deletion ansible/ansible.cfg → ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[defaults]
inventory = hosts.yaml
error_on_undefined_vars = false
timeout = 30
forks = 10
connection_plugins = plugins/connection/

stdout_callback = yaml

[inventory]
enable_plugins = yaml
3 changes: 0 additions & 3 deletions ansible/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions ansible/Pipfile

This file was deleted.

74 changes: 0 additions & 74 deletions ansible/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions ansible/ansible_requirements.yml

This file was deleted.

Loading
Loading