summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2020-03-17 15:02:28 +0200
committerzsdc <taras@vyos.io>2020-03-17 18:50:52 +0200
commitffd398585f441f6cc3b23e9080f48ed7fe951069 (patch)
treeb0fefe40b77c703f7451c7e0eefca60c4ab9a307
parent22e169c8ba541666f8beab483cc48c4f9508d91e (diff)
downloadvyos-vm-images-ffd398585f441f6cc3b23e9080f48ed7fe951069.tar.gz
vyos-vm-images-ffd398585f441f6cc3b23e9080f48ed7fe951069.zip
Replaced deletion of cc_vyos by disabling modules in config
-rw-r--r--README.md12
-rw-r--r--roles/create-pxe-archive/tasks/main.yml10
-rw-r--r--roles/install-cloud-init/files/90_disable_config_stage.cfg2
-rw-r--r--roles/install-cloud-init/tasks/main.yml9
4 files changed, 17 insertions, 16 deletions
diff --git a/README.md b/README.md
index 635c145..d4b60fa 100644
--- a/README.md
+++ b/README.md
@@ -88,6 +88,11 @@ You need to copy the ISO image with VyOS to /tmp/vyos.iso before running ansible
-e cloud_init_ds=NoCloud,ConfigDrive,None
```
+- Disable configuration stage modules in Cloud-init. Mostly useful when you are building for non-cloud environments, where Cloud-init meta-data is not available (default: false):
+ ```
+ -e cloud_init_disable_config=true
+ ```
+
- Create an archive with files required to PXE boot (default: false):
```
@@ -98,9 +103,4 @@ You need to copy the ISO image with VyOS to /tmp/vyos.iso before running ansible
```
-e keep_user=true
- ```
-
-- Exclude the `cc_vyos` module from Cloud-init in the PXE archive. Mostly useful when you are building for non-cloud environments, where Cloud-init meta-data is not available (default: false):
- ```
- -e pxe_excl_module=true
- ```
+ ``` \ No newline at end of file
diff --git a/roles/create-pxe-archive/tasks/main.yml b/roles/create-pxe-archive/tasks/main.yml
index 2357d12..147dd45 100644
--- a/roles/create-pxe-archive/tasks/main.yml
+++ b/roles/create-pxe-archive/tasks/main.yml
@@ -23,20 +23,10 @@
# We need to skip boot directory (it contain too much unneeded items) and cc_vyos.py (optionally - may conflict with User-Data handler)
- name: Create new squashfs image
become: true
- command: "mksquashfs {{ vyos_install_root }} /tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag | default() }}/filesystem.squashfs -comp gzip -no-progress -Xcompression-level 9 -e {{ vyos_install_root }}/boot -e {{ vyos_install_root }}/usr/lib/python3/dist-packages/cloudinit/config/cc_vyos.py"
- when:
- - pxe is defined
- - pxe == "true"
- - pxe_excl_module is defined
- - pxe_excl_module == "true"
-
-- name: Create new squashfs image
- become: true
command: "mksquashfs {{ vyos_install_root }} /tmp/vyos-pxe-{{ vyos_version }}{{ ci_tag | default() }}/filesystem.squashfs -comp gzip -no-progress -Xcompression-level 9 -e {{ vyos_install_root }}/boot"
when:
- pxe is defined
- pxe == "true"
- - pxe_excl_module is not defined
- name: Add the /boot directory
become: true
diff --git a/roles/install-cloud-init/files/90_disable_config_stage.cfg b/roles/install-cloud-init/files/90_disable_config_stage.cfg
new file mode 100644
index 0000000..867621d
--- /dev/null
+++ b/roles/install-cloud-init/files/90_disable_config_stage.cfg
@@ -0,0 +1,2 @@
+# Disable all config-stage modules
+cloud_config_modules:
diff --git a/roles/install-cloud-init/tasks/main.yml b/roles/install-cloud-init/tasks/main.yml
index 39f7293..2ae314b 100644
--- a/roles/install-cloud-init/tasks/main.yml
+++ b/roles/install-cloud-init/tasks/main.yml
@@ -50,9 +50,18 @@
- name: run dpkg-reconfigure cloud-init
become: true
command: chroot {{ vyos_install_root }} dpkg-reconfigure -f noninteractive cloud-init
+- name: Disable config-stage modules
+ become: true
+ copy:
+ src: "files/90_disable_config_stage.cfg"
+ dest: "{{ vyos_install_root }}/etc/cloud/cloud.cfg.d/90_disable_config_stage.cfg"
+ when:
+ - cloud_init_disable_config is defined
+ - cloud_init_disable_config == "true"
- name: restore original resolv.conf
become: true
command: mv /tmp/resolv.conf {{ vyos_install_root }}/etc/resolv.conf
- name: change /etc/network/interfaces to include config from Cloud-Init
become: true
command: chroot {{ vyos_install_root }} sed -i 's/source-directory \/etc\/network\/interfaces.d/source \/etc\/network\/interfaces.d\/*/g' /etc/network/interfaces
+ when: vyos_version is regex("^1\.2.*$")