Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreygubarev/ansible-debian
Ansible Collection for Debian configuration
https://github.com/andreygubarev/ansible-debian
ansible debian ubuntu
Last synced: 5 days ago
JSON representation
Ansible Collection for Debian configuration
- Host: GitHub
- URL: https://github.com/andreygubarev/ansible-debian
- Owner: andreygubarev
- License: mit
- Created: 2023-06-13T16:13:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-12T07:03:30.000Z (12 months ago)
- Last Synced: 2024-10-10T22:15:01.637Z (27 days ago)
- Topics: ansible, debian, ubuntu
- Language: Python
- Homepage: https://galaxy.ansible.com/ui/repo/published/andreygubarev/debian/
- Size: 161 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `andreygubarev.debian`
Ansible collection for Debian
## Installation
To install this collection use the `ansible-galaxy` command-line tool:
```sh
ansible-galaxy collection install andreygubarev.debian
```## Roles `andreygubarev.debian.tmproot_mount` and `andreygubarev.debian.tmproot_unmount`
Role `tmproot_mount` mounts tmpfs to root partition and moves root to tmpfs. Role `tmproot_unmount` unmounts tmpfs and moves root back to root partition. Mounting temporary root partition is required for:
- modifying root partition (including resizing)
- creating separate partitions for `/var`, `/home`, `/tmp` folders`tmproot_*` roles implement the following logic:
1.1 Mount tmpfs to `/mnt/tmproot` and performs `debootstrap` into it
1.2 Copies SSH keys from root partition to `/mnt/tmproot` for `root` user
1.3 Stops all running services (except SSH and NetworkManager)
1.4 Pivot root and temporary root
1.5 Starts SSH server
1.6 Unmounts root partition
2.1 Mounts root partition to `/mnt/root`
2.2 Pivot temporary root and root
2.3 Starts all servicesUsage example:
```yaml
- name: Temporary root
hosts: all
become: true
roles:
- role: tmproot_mount
# do something with root partition
- role: tmproot_unmount
vars:
tmproot_partition: /dev/vda2
```Roles are necessary to address the issue of modifying the root partition without rebooting the instance. Typically, OS images have a single root partition, which cannot be modified without a reboot. This poses a challenge for automation since it requires manual intervention. The `tmproot_*` roles resolve this problem by mounting a temporary root partition and transferring the root to it. As a result, the root partition can be modified without having to reboot the instance.
Caveats:
- Roles require `root` user to be able to login via SSH. This is required to be able to pivot root and temporary root. Role uses `root` user `authorized_keys` to login via SSH.
- Roles require at least 1GB of RAM to be able to mount tmpfs. This is required to be able to perform `debootstrap` into tmpfs.# Reference
- [Ansible Galaxy](https://galaxy.ansible.com/andreygubarev/debian) - Find more information and download the collection.
- [Source Code](https://github.com/andreygubarev/ansible-debian) - Access the collection's source code on Github.