From 660667da57734ce8863b0e261bf1b3890addf568 Mon Sep 17 00:00:00 2001 From: Luis Arizmendi Date: Mon, 10 Jun 2024 19:05:24 +0200 Subject: [PATCH 1/9] add ignition to simplified installer blueprint --- roles/builder/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/builder/tasks/main.yml b/roles/builder/tasks/main.yml index b33c8f26..db2c4d01 100644 --- a/roles/builder/tasks/main.yml +++ b/roles/builder/tasks/main.yml @@ -264,10 +264,10 @@ ansible.builtin.set_fact: __simplified_insaller_customizations: {} - - name: Set __simplified_insaller_customizations value including only fdo and installation_device customizations + - name: Set __simplified_insaller_customizations value including only fdo, ignition and installation_device customizations ansible.builtin.set_fact: __simplified_insaller_customizations: "{{ __simplified_insaller_customizations | combine({item.key: item.value}) }}" - when: "item.key in ['fdo', 'installation_device']" + when: "item.key in ['fdo', 'installation_device', 'ignition']" with_dict: "{{ builder_compose_customizations }}" - name: Create simplified installer blueprint From 86ef0f770029296b3c3f19c8e263ca1fedec5d69 Mon Sep 17 00:00:00 2001 From: Luis Arizmendi Date: Tue, 11 Jun 2024 01:39:15 +0200 Subject: [PATCH 2/9] add ignition to simplified installer --- CHANGELOG.rst | 10 ++++++++++ galaxy.yml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f62394c4..a94f87f9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,16 @@ Infra.Osbuild Release Notes .. contents:: Topics +v2.3.1 +====== + +Minor Changes +------------- + +- Include blueprint import file option +- Add ignition to simplified installer blueprint + + v2.3.0 ====== diff --git a/galaxy.yml b/galaxy.yml index 63aece04..b077f223 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: infra name: osbuild # The version of the collection. Must be compatible with semantic versioning -version: 2.3.0 +version: 2.3.1 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md From 81e6617b57f52fa1186171f888b48255fa3976d8 Mon Sep 17 00:00:00 2001 From: Luis Arizmendi Date: Wed, 19 Jun 2024 12:17:53 +0200 Subject: [PATCH 3/9] add containers to blueprint --- CHANGELOG.rst | 8 ++++++++ plugins/modules/create_blueprint.py | 14 ++++++++++++++ roles/builder/README.md | 17 +++++++++++++++++ roles/builder/meta/argument_specs.yaml | 6 ++++++ roles/builder/tasks/main.yml | 1 + 5 files changed, 46 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a94f87f9..d33d4b1a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,14 @@ Infra.Osbuild Release Notes .. contents:: Topics +v2.3.2 +====== + +Minor Changes +------------- + +- Add [[container]] section in generated blueprint, to support embedded container images + v2.3.1 ====== diff --git a/plugins/modules/create_blueprint.py b/plugins/modules/create_blueprint.py index 7ea0f873..d65e2103 100644 --- a/plugins/modules/create_blueprint.py +++ b/plugins/modules/create_blueprint.py @@ -73,6 +73,13 @@ elements: str default: [] required: false + containers: + description: + - List of container images to embed into the image + type: list + elements: str + default: [] + required: false customizations: description: - Dictionary of customizations @@ -122,6 +129,7 @@ packages=dict(type="list", required=False, elements="str", default=[]), groups=dict(type="list", required=False, elements="str", default=[]), customizations=dict(type="dict", required=False, default={}), + containers=dict(type="list", required=False, elements="str", default=[]), ) @@ -188,6 +196,12 @@ def create_blueprint(module, weldr): else: toml_data["customizations"][key]: dict = customization + if module.params["containers"]: + toml_data["containers"]: list = [] + for container in module.params["containers"]: + container = container.strip() + toml_data["containers"].append({"source": f"{container}"}) + try: with open(module.params["dest"], "w") as fd: weldr.toml.dump(toml_data, fd) diff --git a/roles/builder/README.md b/roles/builder/README.md index 6212a5bf..6cbf1a90 100644 --- a/roles/builder/README.md +++ b/roles/builder/README.md @@ -253,6 +253,23 @@ builder_compose_pkgs: - "tmux" ``` + +### builder_compose_containers + +Type: list +Required: false + +List of Container images to include in the image. + +Example: + +```yaml +builder_compose_containers: + - quay.io/luisarizmendi/kiosk-token:latest + - quay.io/luisarizmendi/secret-http:latest +``` + + ### builder_compose_customizations Type: dict diff --git a/roles/builder/meta/argument_specs.yaml b/roles/builder/meta/argument_specs.yaml index e5efc2d2..027f9665 100644 --- a/roles/builder/meta/argument_specs.yaml +++ b/roles/builder/meta/argument_specs.yaml @@ -111,6 +111,12 @@ argument_specs: description: "List of RPMs to include in the image." elements: "str" + builder_compose_containers: + type: "list" + required: false + description: "List of Container Images to include in the image." + elements: "str" + builder_compose_customizations: type: "dict" required: false diff --git a/roles/builder/tasks/main.yml b/roles/builder/tasks/main.yml index db2c4d01..bce60db0 100644 --- a/roles/builder/tasks/main.yml +++ b/roles/builder/tasks/main.yml @@ -95,6 +95,7 @@ distro: "{{ builder_blueprint_distro | default(omit) }}" packages: "{{ builder_compose_pkgs | default(omit) }}" customizations: "{{ builder_compose_customizations | default(omit) }}" + containers: "{{ builder_compose_containers | default(omit) }}" register: builder_blueprint_output when: builder_blueprint_import_file is not defined From 0d2d092288e856f375ec8b7321f96f5218d8bfd2 Mon Sep 17 00:00:00 2001 From: Luis Arizmendi Date: Wed, 19 Jun 2024 12:21:59 +0200 Subject: [PATCH 4/9] add containers to blueprint --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index b077f223..aeb0ad09 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: infra name: osbuild # The version of the collection. Must be compatible with semantic versioning -version: 2.3.1 +version: 2.3.2 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md From 2f0ff919516a1f10af1bca5aeb578e15dc702ab9 Mon Sep 17 00:00:00 2001 From: Luis Javier Arizmendi Alonso Date: Thu, 25 Jul 2024 16:50:24 +0200 Subject: [PATCH 5/9] Indentation --- roles/builder/tasks/main.yml | 48 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/roles/builder/tasks/main.yml b/roles/builder/tasks/main.yml index bce60db0..21c7bb56 100644 --- a/roles/builder/tasks/main.yml +++ b/roles/builder/tasks/main.yml @@ -100,30 +100,30 @@ when: builder_blueprint_import_file is not defined - block: - - name: Copy the blueprint file - copy: - src: "{{ builder_blueprint_import_file }}" - dest: "{{ builder_blueprint_src_path }}" - - ## TODO: Check the imported file TOML format - - name: Read the content of the TOML file - slurp: - src: "{{ builder_blueprint_src_path }}" - register: toml_file_content - - - name: Parse TOML content - shell: "echo '{{ toml_file_content.content | b64decode }}' | python -c 'import sys, toml; print(toml.loads(sys.stdin.read())[\"version\"])'" - register: _imported_blueprint_version - - - name: Set blueprint name in the imported TOML file - shell: "sed -i '0,/name =/ s/name =.*/name = \"{{ builder_blueprint_name }}\"/' {{ builder_blueprint_src_path }}" - - - name: Set expected var output with current_version from TOML - set_fact: - builder_blueprint_output: - msg: "Blueprint file written to location: {{ builder_blueprint_src_path }}" - changed: true - current_version: "{{ _imported_blueprint_version.stdout }}" + - name: Copy the blueprint file + copy: + src: "{{ builder_blueprint_import_file }}" + dest: "{{ builder_blueprint_src_path }}" + + ## TODO: Check the imported file TOML format + - name: Read the content of the TOML file + slurp: + src: "{{ builder_blueprint_src_path }}" + register: toml_file_content + + - name: Parse TOML content + shell: "echo '{{ toml_file_content.content | b64decode }}' | python -c 'import sys, toml; print(toml.loads(sys.stdin.read())[\"version\"])'" + register: _imported_blueprint_version + + - name: Set blueprint name in the imported TOML file + shell: "sed -i '0,/name =/ s/name =.*/name = \"{{ builder_blueprint_name }}\"/' {{ builder_blueprint_src_path }}" + + - name: Set expected var output with current_version from TOML + set_fact: + builder_blueprint_output: + msg: "Blueprint file written to location: {{ builder_blueprint_src_path }}" + changed: true + current_version: "{{ _imported_blueprint_version.stdout }}" when: builder_blueprint_import_file is defined - name: Push the blueprint into image builder From 14205fe0a0d2cdfceb5ad276f6a39c0298a79420 Mon Sep 17 00:00:00 2001 From: Luis Javier Arizmendi Alonso Date: Thu, 25 Jul 2024 17:01:54 +0200 Subject: [PATCH 6/9] trailing whitespace --- plugins/modules/create_blueprint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/create_blueprint.py b/plugins/modules/create_blueprint.py index d65e2103..245e335d 100644 --- a/plugins/modules/create_blueprint.py +++ b/plugins/modules/create_blueprint.py @@ -129,7 +129,7 @@ packages=dict(type="list", required=False, elements="str", default=[]), groups=dict(type="list", required=False, elements="str", default=[]), customizations=dict(type="dict", required=False, default={}), - containers=dict(type="list", required=False, elements="str", default=[]), + containers=dict(type="list", required=False, elements="str", default=[]), ) From 7e8bfba14c6aeedfc6e5165e58825ad0777aa444 Mon Sep 17 00:00:00 2001 From: Luis Javier Arizmendi Alonso Date: Thu, 25 Jul 2024 17:08:46 +0200 Subject: [PATCH 7/9] unit test update for "container" arg --- tests/unit/plugins/modules/test_create_blueprint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/plugins/modules/test_create_blueprint.py b/tests/unit/plugins/modules/test_create_blueprint.py index 595931fc..679d6261 100644 --- a/tests/unit/plugins/modules/test_create_blueprint.py +++ b/tests/unit/plugins/modules/test_create_blueprint.py @@ -20,7 +20,8 @@ "version_type": "patch", "packages": [], "groups": [], - "customizations": {"user": "bob"} + "customizations": {"user": "bob"}, + "containers": [] } From 0bb53482327dc66a7ac5300b032e6b5bd51d1240 Mon Sep 17 00:00:00 2001 From: Luis Javier Arizmendi Alonso Date: Thu, 25 Jul 2024 17:14:28 +0200 Subject: [PATCH 8/9] Unicode quotes --- blueprints/rhel-9-latest-HIPAA.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueprints/rhel-9-latest-HIPAA.toml b/blueprints/rhel-9-latest-HIPAA.toml index 859448cc..75d59592 100644 --- a/blueprints/rhel-9-latest-HIPAA.toml +++ b/blueprints/rhel-9-latest-HIPAA.toml @@ -3,7 +3,7 @@ # Blueprint for Health Insurance Portability and Accountability Act (HIPAA) # # Profile Description: -# The HIPAA Security Rule establishes U.S. national standards to protect individuals’ +# The HIPAA Security Rule establishes U.S. national standards to protect individuals # electronic personal health information that is created, received, used, or # maintained by a covered entity. The Security Rule requires appropriate # administrative, physical and technical safeguards to ensure the From 94884484f35751cc4fd43655ea9d82e9b167a92e Mon Sep 17 00:00:00 2001 From: Luis Javier Arizmendi Alonso Date: Thu, 25 Jul 2024 17:27:01 +0200 Subject: [PATCH 9/9] trailing spaces --- roles/builder/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/builder/tasks/main.yml b/roles/builder/tasks/main.yml index 21c7bb56..346811ac 100644 --- a/roles/builder/tasks/main.yml +++ b/roles/builder/tasks/main.yml @@ -104,20 +104,20 @@ copy: src: "{{ builder_blueprint_import_file }}" dest: "{{ builder_blueprint_src_path }}" - + ## TODO: Check the imported file TOML format - name: Read the content of the TOML file slurp: src: "{{ builder_blueprint_src_path }}" register: toml_file_content - + - name: Parse TOML content shell: "echo '{{ toml_file_content.content | b64decode }}' | python -c 'import sys, toml; print(toml.loads(sys.stdin.read())[\"version\"])'" register: _imported_blueprint_version - + - name: Set blueprint name in the imported TOML file shell: "sed -i '0,/name =/ s/name =.*/name = \"{{ builder_blueprint_name }}\"/' {{ builder_blueprint_src_path }}" - + - name: Set expected var output with current_version from TOML set_fact: builder_blueprint_output: