summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2023-12-27 12:57:12 +0200
committerzdc <zdc@users.noreply.github.com>2023-12-27 13:51:15 +0200
commit531cbdcffd2fda1a0be11588c7a785dd9afb7665 (patch)
treea8dc809bfc127e2200ac6a22b461c73ed22c6204
parent07825901d1ebb483ac6edc39e0a4c224fad82638 (diff)
downloadvyos-vm-images-531cbdcffd2fda1a0be11588c7a785dd9afb7665.tar.gz
vyos-vm-images-531cbdcffd2fda1a0be11588c7a785dd9afb7665.zip
Added `copy-custom-files` role.
Sometimes we need to add extra files, like configurations. This role allows to copy them into the installation directory.
-rw-r--r--README.md6
-rw-r--r--files/custom_files/.gitkeep0
-rw-r--r--qemu.yml1
-rw-r--r--roles/copy-custom-files/tasks/main.yml7
-rw-r--r--roles/copy-custom-files/tests/inventory2
-rw-r--r--roles/copy-custom-files/tests/test.yml4
6 files changed, 20 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4837894..4990b39 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,12 @@ You need to copy the ISO image with VyOS to /tmp/vyos.iso before running ansible
-e custom_packages=true
```
+- Copy custom files. All files from inside the `files/custom_files/` directory will be copied to the target filesystem recursively:
+
+ ```
+ -e custom_files=true
+ ```
+
- Enable DHCP on eth0 (default: `false`):
```
diff --git a/files/custom_files/.gitkeep b/files/custom_files/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/files/custom_files/.gitkeep
diff --git a/qemu.yml b/qemu.yml
index 10b9a82..5b44cca 100644
--- a/qemu.yml
+++ b/qemu.yml
@@ -29,6 +29,7 @@
- install-cloud-init-wrapper
- install-guest-agent-wrapper
- install-custom-packages-wrapper
+ - copy-custom-files
- fstrim
- unmount-pre
- create-pxe-archive
diff --git a/roles/copy-custom-files/tasks/main.yml b/roles/copy-custom-files/tasks/main.yml
new file mode 100644
index 0000000..11e12c0
--- /dev/null
+++ b/roles/copy-custom-files/tasks/main.yml
@@ -0,0 +1,7 @@
+- name: Copy custom files to the system, preserving paths
+ become: true
+ copy:
+ src: "files/custom_files/"
+ dest: "{{ vyos_install_root }}"
+ force: true
+ when: custom_files is defined
diff --git a/roles/copy-custom-files/tests/inventory b/roles/copy-custom-files/tests/inventory
new file mode 100644
index 0000000..878877b
--- /dev/null
+++ b/roles/copy-custom-files/tests/inventory
@@ -0,0 +1,2 @@
+localhost
+
diff --git a/roles/copy-custom-files/tests/test.yml b/roles/copy-custom-files/tests/test.yml
new file mode 100644
index 0000000..2163c5d
--- /dev/null
+++ b/roles/copy-custom-files/tests/test.yml
@@ -0,0 +1,4 @@
+---
+- hosts: localhost
+ roles:
+ - copy-custom-files