Skip to content

Commit 85bb885

Browse files
authored
Merge pull request #29 from linux-kdevops/cel-fixes
Fixes related to guestfs and terraform provisioning
2 parents 533be4c + dc032f9 commit 85bb885

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+921
-333
lines changed

Kconfig

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,6 @@
55

66
mainmenu "$(PROJECT) $(PROJECTRELEASE)"
77

8-
config TOPDIR_PATH
9-
string
10-
output yaml
11-
default $(shell, echo $TOPDIR_PATH)
12-
13-
config TOPDIR_PATH_HAS_SHA256SUM
14-
bool
15-
output yaml
16-
default y
17-
18-
config TOPDIR_PATH_SHA256SUM
19-
string
20-
output yaml
21-
default $(shell, ./scripts/compute_sha256sum.sh $(TOPDIR_PATH))
22-
238
config HAVE_KDEVOPS_CUSTOM_DEFAULTS
249
bool
2510
default n

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export KDEVOPS_NODES :=
1919
export PYTHONUNBUFFERED=1
2020
export TOPDIR=./
2121
export TOPDIR_PATH = $(shell readlink -f $(TOPDIR))
22+
export TOPDIR_PATH_SHA256SUM = $(shell ./scripts/compute_sha256sum.sh $(TOPDIR_PATH))
2223

2324
# Export CLI override variables for Kconfig to detect them
2425
# Note: We accept DECLARE_HOSTS but export as DECLARED_HOSTS for consistency
@@ -32,11 +33,21 @@ KDEVOPS_NODES_ROLE_TEMPLATE_DIR := $(KDEVOPS_PLAYBOOKS_DIR)/roles/gen_nodes/tem
3233
export KDEVOPS_NODES_TEMPLATE :=
3334
export KDEVOPS_MRPROPER :=
3435

36+
ifeq (y,$(CONFIG_ANSIBLE_CFG_FILE_CUSTOM))
3537
ifneq ($(strip $(CONFIG_ANSIBLE_CFG_FILE)),)
3638
ANSIBLE_CFG_FILE := $(shell echo $(CONFIG_ANSIBLE_CFG_FILE) | tr --delete '"')
3739
export ANSIBLE_CONFIG := $(ANSIBLE_CFG_FILE)
3840
endif
41+
else
42+
ANSIBLE_CFG_FILE := $(TOPDIR_PATH)/ansible.cfg
43+
export ANSIBLE_CONFIG := $(ANSIBLE_CFG_FILE)
44+
endif
45+
46+
ifeq (y,$(CONFIG_ANSIBLE_CFG_INVENTORY_CUSTOM))
3947
ANSIBLE_INVENTORY_FILE := $(shell echo $(CONFIG_ANSIBLE_CFG_INVENTORY) | tr --delete '"')
48+
else
49+
ANSIBLE_INVENTORY_FILE := $(TOPDIR_PATH)/hosts
50+
endif
4051

4152
KDEVOPS_INSTALL_TARGETS :=
4253

@@ -89,6 +100,13 @@ INCLUDES = -I include/
89100
CFLAGS += $(INCLUDES)
90101

91102
ANSIBLE_EXTRA_ARGS += kdevops_version='$(PROJECTRELEASE)'
103+
ANSIBLE_EXTRA_ARGS += topdir_path_sha256sum='$(TOPDIR_PATH_SHA256SUM)'
104+
ifneq (y,$(CONFIG_ANSIBLE_CFG_FILE_CUSTOM))
105+
ANSIBLE_EXTRA_ARGS += ansible_cfg_file='$(ANSIBLE_CFG_FILE)'
106+
endif
107+
ifneq (y,$(CONFIG_ANSIBLE_CFG_INVENTORY_CUSTOM))
108+
ANSIBLE_EXTRA_ARGS += ansible_cfg_inventory='$(ANSIBLE_INVENTORY_FILE)'
109+
endif
92110

93111
export KDEVOPS_HOSTS_TEMPLATE := hosts.j2
94112

Makefile.kdevops

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PHONY := kdevops_all
99

1010
kdevops_terraform_deps:
1111
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
12+
--inventory localhost, \
1213
$(KDEVOPS_PLAYBOOKS_DIR)/install_terraform.yml
1314
PHONY += kdevops_terraform_deps
1415

kconfigs/Kconfig.ansible_cfg

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ config ANSIBLE_CFG_INVENTORY_SET_BY_CLI
1818
bool
1919
default $(shell, scripts/check-cli-set-var.sh KDEVOPS_HOSTS)
2020

21+
config ANSIBLE_CFG_FILE_CUSTOM
22+
bool "Set a custom location for the ansible.cfg file"
23+
help
24+
When this option is set to N, kdevops creates an ansible.cfg
25+
in a sensible default location, using the settings defined
26+
in this Kconfig menu. If it is set to Y, you can set the
27+
path and filename of the Ansible configuration file.
28+
29+
if ANSIBLE_CFG_FILE_CUSTOM
30+
2131
config ANSIBLE_CFG_FILE
2232
string "Ansible configuration file"
2333
output yaml
@@ -41,6 +51,8 @@ config ANSIBLE_CFG_FILE
4151
For more details, refer to the Ansible documentation:
4252
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#the-configuration-file
4353

54+
endif # ANSIBLE_CFG_FILE_CUSTOM
55+
4456
menu "Ansible Callback Plugin Configuration"
4557
choice
4658
prompt "Ansible Callback Plugin"
@@ -251,6 +263,16 @@ config ANSIBLE_CFG_TASK_DEBUGGER
251263

252264
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_debugger.html#id10
253265

266+
config ANSIBLE_CFG_INVENTORY_CUSTOM
267+
bool "Set a custom location for the Ansible inventory"
268+
help
269+
When this option is set to N, kdevops creates its
270+
inventory file in a sensible default location. If it is
271+
set to Y, you can set the path and filename of the Ansible
272+
inventory.
273+
274+
if ANSIBLE_CFG_INVENTORY_CUSTOM
275+
254276
config ANSIBLE_CFG_INVENTORY
255277
string "Ansible inventory sources"
256278
output yaml
@@ -270,6 +292,8 @@ config ANSIBLE_CFG_INVENTORY
270292
For more details, refer to the Ansible documentation:
271293
https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-host-list
272294

295+
endif # ANSIBLE_CFG_INVENTORY_CUSTOM
296+
273297
if DISTRO_OPENSUSE
274298

275299
config ANSIBLE_CFG_RECONNECTION_RETRIES

kconfigs/Kconfig.libvirt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,51 @@ config LIBVIRT_HOST_PASSTHROUGH
556556
--pre 'make -s mrproper defconfig' \
557557
\-- make -s -j$(nproc) bzImage
558558

559+
choice
560+
prompt "Libvirt extra storage drive count"
561+
default LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_4
562+
help
563+
This option selects the number of extra storage drives to
564+
provision for each libvirt guest. Reduce this number to
565+
conserve local host storage capacity, if your workflows do
566+
not use all the extra drives.
567+
568+
config LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_0
569+
bool "0"
570+
help
571+
Provision no extra storage drives per guest.
572+
573+
config LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_1
574+
bool "1"
575+
help
576+
Provision one extra storage drive per guest.
577+
578+
config LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_2
579+
bool "2"
580+
help
581+
Provision two extra storage drives per guest.
582+
583+
config LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_3
584+
bool "3"
585+
help
586+
Provision three extra storage drives per guest.
587+
588+
config LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_4
589+
bool "4"
590+
help
591+
Provision four extra storages drive per guest.
592+
593+
endchoice
594+
595+
config LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT
596+
int
597+
output yaml
598+
default 0 if LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_0
599+
default 1 if LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_1
600+
default 2 if LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_2
601+
default 3 if LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_3
602+
default 4 if LIBVIRT_EXTRA_STORAGE_DRIVE_COUNT_4
603+
559604
choice
560605
prompt "Libvirt extra storage driver to use"
561606
default LIBVIRT_EXTRA_STORAGE_DRIVE_VIRTIO

playbooks/devconfig.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Configure developer environment on target systems
3-
hosts: baseline:dev
3+
hosts: baseline:dev:service
44
gather_facts: false
55
roles:
66
- role: devconfig

playbooks/gen_tfvars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
- name: Generate Terraform variables file (terraform/terraform.tfvars)
3+
connection: local
34
hosts: localhost
45
roles:
56
- role: gen_tfvars

playbooks/guestfs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: Provision target nodes with libvirt/guestfs
2+
- name: Manage infrastructure lifecycle and SSH access with libvirt/guestfs
33
gather_facts: true
44
connection: local
55
hosts: all

playbooks/install_terraform.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
- name: Install Terraform
3+
connection: local
34
hosts: localhost
45
roles:
56
- role: install_terraform

playbooks/roles/base_image/templates/virt-builder.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mkdir {{ target_dir }}
1111
copy-in {{ guestfs_distro_source_and_dest_file }}:{{ target_dir }}
1212
{% endif %}
1313

14-
install sudo,qemu-guest-agent,python3,bash,locales-all
14+
install sudo,qemu-guest-agent,python3,bash
1515
run-command useradd {{ kdevops_uid }} -s /bin/bash -m kdevops
1616
append-line /etc/sudoers.d/kdevops:kdevops ALL=(ALL) NOPASSWD: ALL
1717
edit /etc/default/grub:s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"/

0 commit comments

Comments
 (0)