Merge "Feature: Enable user_data's file generation"

This commit is contained in:
Zuul 2023-01-20 20:18:50 +00:00 committed by Gerrit Code Review
commit be55c28d60
4 changed files with 39 additions and 0 deletions

View File

@ -32,3 +32,12 @@ iso_gen_utility: "mkisofs"
# Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment
bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}"
ansible_python_interpreter: "{{ bifrost_venv_dir + '/bin/python3' }}"
# Define your user-data's script here (cloud-config syntax)
# For example:
# user_data_content: |
# users:
# name: myuser
#
# timezone: "Europe/Paris"
+user_data_content:

View File

@ -83,6 +83,16 @@
when:
- addressing_mode is undefined or "dhcp" not in addressing_mode
- name: "Generate user_data"
template:
src: raw_user_data.j2
dest: "{{ variable_configdrive_location.path }}/{{ uuid }}/openstack/{{ item }}/user_data"
loop: "{{ metadata_versions }}"
when:
- user_data_content is defined
- user_data_content | length > 0
- name: "Make metadata folder - /openstack/content"
file:
state: directory

View File

@ -0,0 +1,3 @@
#cloud-config
{{ user_data_content }}

View File

@ -0,0 +1,17 @@
---
features:
- |
bifrost introduce now the ``user_data content`` variable
which allows to the user to provide its custom cloud-config file
For example:
.. code-block:: yaml
user_data_content: |
users:
name: myuser
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
passwd: <HASH_OF_MY_PASSWORD>
lock_passwd: false
timezone: "Europe/Paris"