-
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.
Update Debian cloud image for running on Proxmox
- Loading branch information
Showing
10 changed files
with
270 additions
and
29 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,8 @@ | ||
[proxmox] | ||
192.168.1.20 | ||
|
||
[localhost] | ||
localhost | ||
|
||
[chroot] | ||
/mnt |
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,100 @@ | ||
--- | ||
- name: Mount/Unmount Cloud Image | ||
connection: local | ||
hosts: localhost | ||
gather_facts: yes | ||
become: True | ||
vars: | ||
cloud_image: "{{ lookup('ansible.builtin.env', 'HOME') }}/Downloads/debian-12-generic-amd64-daily-20231117-1567.qcow2" | ||
mount_point: "/mnt" | ||
mount_device: "/dev/nbd0" | ||
tasks: | ||
- name: Load NBD Module | ||
community.general.modprobe: | ||
name: "nbd" | ||
params: "max_part=2" | ||
state: present | ||
tags: | ||
- mount | ||
|
||
- name: Connect Cloud Image Using NBD | ||
ansible.builtin.shell: | ||
cmd: "qemu-nbd --connect={{ mount_device }} {{ cloud_image }}" | ||
args: | ||
executable: /bin/bash | ||
tags: | ||
- mount | ||
|
||
- name: Mount the NBD Exported Cloud Image | ||
ansible.posix.mount: | ||
src: "{{ mount_device }}p1" | ||
path: "{{ mount_point }}" | ||
fstype: auto | ||
state: ephemeral | ||
tags: | ||
- mount | ||
|
||
- name: Mount /sys and /dev into {{ mount_point }} | ||
ansible.posix.mount: | ||
src: "{{ item }}" | ||
path: "{{ mount_point }}{{ item }}" | ||
fstype: none | ||
opts: bind | ||
state: ephemeral | ||
with_items: | ||
- "/sys" | ||
- "/dev" | ||
tags: | ||
- mount | ||
|
||
- name: Remove Existing File {{ mount_point }}/etc/resolv.conf | ||
ansible.builtin.file: | ||
path: "{{ mount_point }}/etc/resolv.conf" | ||
state: absent | ||
tags: | ||
- mount | ||
- unmount | ||
|
||
- name: Copy /etc/resolv.conf to {{ mount_point }}/etc/resolv.conf | ||
ansible.builtin.copy: | ||
src: "/etc/resolv.conf" | ||
dest: "{{ mount_point }}/etc/resolv.conf" | ||
tags: | ||
- mount | ||
|
||
- name: Restore Symlink {{ mount_point }}/etc/resolv.conf | ||
ansible.builtin.file: | ||
path: "/etc/resolv.conf" | ||
state: absent | ||
delegate_to: chroot | ||
vars: | ||
ansible_connection: community.general.chroot | ||
tags: | ||
- mount | ||
- unmount | ||
|
||
- name: Umount /sys, /dev and {{ mount_point }} | ||
ansible.posix.mount: | ||
path: "{{ item }}" | ||
state: unmounted | ||
with_items: | ||
- "{{ mount_point }}/sys" | ||
- "{{ mount_point }}/dev" | ||
- "{{ mount_point }}" | ||
tags: | ||
- unmount | ||
|
||
- name: Disconnect Cloud Image Using NBD | ||
ansible.builtin.shell: | ||
cmd: "qemu-nbd --disconnect {{ mount_device }}" | ||
args: | ||
executable: /bin/bash | ||
tags: | ||
- unmount | ||
|
||
- name: Unload NBD Module | ||
community.general.modprobe: | ||
name: "nbd" | ||
state: absent | ||
tags: | ||
- unmount |
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,17 +1,7 @@ | ||
--- | ||
- name: Create and Start Proxmox VMs | ||
hosts: all | ||
hosts: proxmox | ||
gather_facts: yes | ||
become: True | ||
roles: | ||
- provision_proxmox_vms | ||
tags: create-and-start-vms | ||
|
||
- name: Run Common Roles | ||
hosts: k8s_nodes | ||
gather_facts: yes | ||
become: True | ||
roles: | ||
- linux_common | ||
- motd | ||
tags: common-roles |
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,15 @@ | ||
--- | ||
# defaults file for pve_ci_tweak | ||
pve_ci_image: "" | ||
pve_ci_update_grub_cmdline: True | ||
pve_ci_grub_config_path: "/etc/default/grub" | ||
pve_ci_grub_cmdline: 'GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"' | ||
pve_ci_kernel_modules_override_path: "/etc/modules-load.d/override.conf" | ||
pve_ci_kernel_modules: | | ||
nf_conntrack | ||
br_netfilter | ||
pve_ci_sysctl_override_path: "/etc/sysctl.d/override.conf" | ||
pve_ci_sysctl_parameters: | ||
vm.swappiness=1 | ||
net.ipv4.ip_forward=1 | ||
net.bridge.bridge-nf-call-iptables=1 |
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,52 @@ | ||
galaxy_info: | ||
author: your name | ||
description: your role description | ||
company: your company (optional) | ||
|
||
# If the issue tracker for your role is not on github, uncomment the | ||
# next line and provide a value | ||
# issue_tracker_url: http://example.com/issue/tracker | ||
|
||
# Choose a valid license ID from https://spdx.org - some suggested licenses: | ||
# - BSD-3-Clause (default) | ||
# - MIT | ||
# - GPL-2.0-or-later | ||
# - GPL-3.0-only | ||
# - Apache-2.0 | ||
# - CC-BY-4.0 | ||
license: license (GPL-2.0-or-later, MIT, etc) | ||
|
||
min_ansible_version: 2.1 | ||
|
||
# If this a Container Enabled role, provide the minimum Ansible Container version. | ||
# min_ansible_container_version: | ||
|
||
# | ||
# Provide a list of supported platforms, and for each platform a list of versions. | ||
# If you don't wish to enumerate all versions for a particular platform, use 'all'. | ||
# To view available platforms and versions (or releases), visit: | ||
# https://galaxy.ansible.com/api/v1/platforms/ | ||
# | ||
# platforms: | ||
# - name: Fedora | ||
# versions: | ||
# - all | ||
# - 25 | ||
# - name: SomePlatform | ||
# versions: | ||
# - all | ||
# - 1.0 | ||
# - 7 | ||
# - 99.99 | ||
|
||
galaxy_tags: [] | ||
# List tags for your role here, one per line. A tag is a keyword that describes | ||
# and categorizes the role. Users find roles by searching for tags. Be sure to | ||
# remove the '[]' above, if you add tags to this list. | ||
# | ||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters. | ||
# Maximum 20 tags per role. | ||
|
||
dependencies: [] | ||
# List your role dependencies here, one per line. Be sure to remove the '[]' above, | ||
# if you add dependencies to this list. |
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,27 @@ | ||
--- | ||
# tasks file for pve_ci_tweak | ||
- name: Update Grub Configuration | ||
ansible.builtin.lineinfile: | ||
path: "{{ pve_ci_grub_config_path }}" | ||
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=' | ||
line: "{{ pve_ci_grub_cmdline }}" | ||
backrefs: yes | ||
when: pve_ci_update_grub_cmdline | ||
|
||
- name: Add Kernel Modules | ||
ansible.builtin.lineinfile: | ||
path: "{{ pve_ci_kernel_modules_override_path }}" | ||
line: "{{ pve_ci_kernel_modules }}" | ||
create: yes | ||
|
||
- name: Update sysctl Parameters | ||
ansible.builtin.lineinfile: | ||
path: "{{ pve_ci_sysctl_override_path }}" | ||
line: "{{ pve_ci_sysctl_parameters }}" | ||
create: yes | ||
|
||
- name: Update Grub | ||
ansible.builtin.shell: | ||
cmd: "update-grub" | ||
args: | ||
executable: /bin/bash |
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,10 @@ | ||
--- | ||
- name: Prepare PVE Cloud Image | ||
connection: community.general.chroot | ||
hosts: chroot | ||
gather_facts: yes | ||
become: True | ||
roles: | ||
- linux_common | ||
- motd | ||
- pve_ci_tweak |