Skip to content

Commit 7334451

Browse files
committed
libvirt, zsh and multipass Ansible roles
Documentation on how to run Rocky linux on Multipass
1 parent 0ea7c68 commit 7334451

File tree

8 files changed

+114
-1
lines changed

8 files changed

+114
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
# automation
1+
# Automation
2+
3+
## Dependencies
4+
5+
- Ansible
6+
- `sudo apt-get install python3-pip -y`
7+
- `pip3 install ansible`
8+
9+
## Run a specific role
10+
11+
```bash
12+
ansible-playbook --connection=local --inventory=127.0.0.1, --ask-become-pass playbook.yml -v -t multipass
13+
```
14+
15+
- Docker
16+
17+
```bash
18+
ansible-galaxy role install geerlingguy.docker
19+
ansible-playbook --connection=local --inventory=127.0.0.1, --ask-become-pass playbook.yml -v -t docker -e 'docker_users=[mandy]'
20+
```

playbook.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
- hosts: all
3+
gather_facts: true
4+
become: true
5+
roles:
6+
- role: zsh
7+
tags: zsh
8+
- role: multipass
9+
tags: multipass
10+
- role: libvirt
11+
tags: libvirt
12+
- role: geerlingguy.docker
13+
tags: docker

roles/libvirt/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Libvirt
2+
3+
## Installation
4+
5+
```bash
6+
sudo apt-get update
7+
sudo apt-get install virt-manager -y --no-install-recommends
8+
9+
sudo usermod -aG libvirt "$USER"
10+
```

roles/libvirt/tasks/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- name: Install libbirt
2+
ansible.builtin.package:
3+
name: virt-manager
4+
state: present
5+
become: true

roles/multipass/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Multipass
2+
3+
## Linux
4+
5+
### Installation
6+
7+
```bash
8+
sudo snap install multipass
9+
sudo snap connect multipass:libvirt
10+
```
11+
12+
[Install libvirt](../libvirt/README.md#installation)
13+
14+
### Configuration
15+
16+
Backend configuration
17+
18+
`multipass set local.driver lxd`
19+
20+
`multipass set local.driver libvirt`
21+
22+
### Launching VM's
23+
24+
- Rocky linux (running other cloud images than Ubuntu is only supported on Linux)
25+
`multipass launch -n rocky -c 2 -d 10G -m 4G https://download.rockylinux.org/pub/rocky/8.6/images/Rocky-8-GenericCloud.latest.x86_64.qcow2`

roles/multipass/tasks/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
- name: Install Multipass
3+
community.general.snap:
4+
name: multipass
5+
become: true
6+
- name: Install libvirt
7+
ansible.builtin.import_role:
8+
name: libvirt
9+
- name: Connect to libvirt
10+
ansible.builtin.shell:
11+
cmd: sudo snap connect multipass:libvirt

roles/zsh/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ZSH
2+
3+
## Installation
4+
5+
```bash
6+
sudo apt-get update
7+
sudo apt-get install zsh fzf --no-install-recommends -y
8+
```
9+
10+
[Documentation on configuring ZSH to play nicely with Snaps](https://askubuntu.com/questions/910821/programs-installed-via-snap-not-showing-up-in-launcher)
11+
12+
```yaml
13+
14+
```

roles/zsh/tasks/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- name: Install ZSH
2+
ansible.builtin.package:
3+
name: zsh
4+
state: present
5+
become: true
6+
- name: Install fzf
7+
ansible.builtin.package:
8+
name: fzf
9+
state: present
10+
become: true
11+
- name: Ensure /etc/profile sh emulation for ZSH
12+
ansible.builtin.lineinfile:
13+
path: /etc/zsh/zprofile
14+
regexp: "^emulate sh.*/etc/profile"
15+
line: emulate sh -c 'source /etc/profile'
16+
become: true

0 commit comments

Comments
 (0)