-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reconcile the latest AI changes for remote workers
With the latest changes from AI, we are able to specify the network using nmstate files. We also can generate the images using AI. Signed-off-by: Yolanda Robla <[email protected]>
- Loading branch information
Showing
18 changed files
with
245 additions
and
468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 0 additions & 105 deletions
105
ai-deploy-cluster-remoteworker/roles/add-remote-workers/tasks/add_remote_worker.yaml
This file was deleted.
Oops, something went wrong.
25 changes: 23 additions & 2 deletions
25
ai-deploy-cluster-remoteworker/roles/add-remote-workers/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 6 additions & 24 deletions
30
ai-deploy-cluster-remoteworker/roles/create-cluster-day2/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,7 @@ | ||
--- | ||
- name: Create a temporary file | ||
tempfile: | ||
state: file | ||
register: tempfile_pullsecret | ||
|
||
- name: Copy pull secret to file | ||
copy: | ||
content: "{{ pull_secret }}" | ||
dest: "{{ tempfile_pullsecret.path }}" | ||
|
||
- name: Create cluster and download ISO | ||
block: | ||
- name: Create new AI cluster | ||
shell: "aicli create cluster -P pull_secret={{ tempfile_pullsecret.path }} -P base_dns_domain={{ cluster_domain }} -P ssh_public_key='{{ ssh_public_key }}' -P openshift_version='{{ cluster_version }}' {{ cluster_name }}-day2" | ||
|
||
- name: Generate the ISO for the cluster | ||
shell: "aicli create iso -P ssh_public_key='{{ ssh_public_key }}' {{ cluster_name }}-day2" | ||
|
||
- name: And download it | ||
shell: "aicli download iso {{ cluster_name }}-day2 -p {{ temporary_path }}" | ||
|
||
environment: | ||
AI_URL: "{{ ai_url }}" | ||
|
||
- name: create day 2 cluster | ||
include_role: | ||
name: "{{ playbook_dir }}/../common-roles/create-cluster" | ||
vars: | ||
extra_args: "-P ingress_vip={{ ingress_vip }}" | ||
cluster_name_var: "{{ cluster_name }}-day2" |
60 changes: 13 additions & 47 deletions
60
ai-deploy-cluster-remoteworker/roles/create-cluster/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,14 @@ | ||
--- | ||
- name: Create a temporary file | ||
tempfile: | ||
state: file | ||
register: tempfile_pullsecret | ||
|
||
- name: Copy pull secret to file | ||
copy: | ||
content: "{{ pull_secret }}" | ||
dest: "{{ tempfile_pullsecret.path }}" | ||
|
||
- name: Create cluster and download ISO | ||
block: | ||
- name: Create new AI cluster | ||
shell: "aicli create cluster -P pull_secret={{ tempfile_pullsecret.path }} -P base_dns_domain={{ cluster_domain }} -P ssh_public_key='{{ ssh_public_key }}' -P ingress_vip={{ ingress_vip }} -P openshift_version='{{ cluster_version }}' {{ cluster_name }}" | ||
retries: 30 | ||
delay: 5 | ||
register: result | ||
until: result.rc == 0 | ||
|
||
- name: Retrieve cluster ID from name | ||
shell: "aicli list cluster | grep {{ cluster_name }} | cut -d '|' -f3 | tr -d ' '" | ||
register: cluster_id | ||
|
||
- name: Set the right network type | ||
uri: | ||
url: "{{ ai_url }}/api/assisted-install/v1/clusters/{{ cluster_id.stdout }}/install-config" | ||
method: PATCH | ||
body: '"{\"networking\": {\"networkType\": \"{{ cluster_sdn | default("OVNKubernetes") }}\"}}"' | ||
body_format: json | ||
status_code: 201 | ||
|
||
- name: Generate the ISO for the cluster | ||
shell: "aicli create iso -P ssh_public_key='{{ ssh_public_key }}' {{ cluster_name }}" | ||
retries: 30 | ||
delay: 5 | ||
register: result | ||
until: result.rc == 0 | ||
|
||
- name: And download it | ||
shell: "aicli download iso {{ cluster_name }} -p {{ temporary_path }}" | ||
retries: 3 | ||
delay: 3 | ||
register: result | ||
until: result.rc == 0 | ||
environment: | ||
AI_URL: "{{ ai_url }}" | ||
|
||
- name: create cluster | ||
include_role: | ||
name: "{{ playbook_dir }}/../common-roles/create-cluster" | ||
vars: | ||
extra_args: "-P ingress_vip={{ ingress_vip }}" | ||
cluster_name_var: "{{ cluster_name }}" | ||
|
||
- name: download ISO | ||
include_role: | ||
name: "{{ playbook_dir }}/../common-roles/download-iso" | ||
vars: | ||
cluster_name_var: "{{ cluster_name }}" | ||
final_iso_path_var: "{{ temporary_path }}" |
9 changes: 5 additions & 4 deletions
9
ai-deploy-cluster-remoteworker/roles/deploy-cluster-day2/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
ai-deploy-cluster-remoteworker/roles/enroll-hosts/templates/ai-vm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 7 additions & 36 deletions
43
ai-deploy-cluster-remoteworker/roles/modify-iso-day2/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,8 @@ | ||
--- | ||
- name: Create temporary directory for script | ||
tempfile: | ||
state: directory | ||
register: script_directory | ||
|
||
- name: Get the script to modify ISOs | ||
get_url: | ||
url: https://raw.githubusercontent.com/redhat-ztp/ztp-iso-generator/main/rhcos-iso/inject_config_files.sh | ||
dest: "{{ script_directory.path }}/inject_config_files.sh" | ||
mode: 0755 | ||
|
||
- name: Get the script to generate ramdisk | ||
get_url: | ||
url: https://raw.githubusercontent.com/redhat-ztp/ztp-iso-generator/main/rhcos-iso/ramdisk_generator.sh | ||
dest: "{{ script_directory.path }}/ramdisk_generator.sh" | ||
mode: 0755 | ||
|
||
- name: Get the script to extract ignition from ISO | ||
get_url: | ||
url: https://raw.githubusercontent.com/redhat-ztp/ztp-iso-generator/main/rhcos-iso/extract_ignition_from_ai_iso.sh | ||
dest: "{{ script_directory.path }}/extract_ignition_from_ai_iso.sh" | ||
mode: 0755 | ||
|
||
- name: Create temporary directory for modifying the ignition | ||
tempfile: | ||
state: directory | ||
register: ignition_directory | ||
|
||
- name: Extract the ignition file from the downloaded ISO | ||
shell: | ||
chdir: "{{ script_directory.path }}" | ||
cmd: "{{ script_directory.path }}/extract_ignition_from_ai_iso.sh {{ temporary_path }}/{{ cluster_name }}-day2.iso {{ ignition_directory.path }}/ai_ignition" | ||
|
||
- name: Modify ISO for all the workers | ||
include_tasks: modify_iso_for_worker.yaml | ||
with_items: "{{ groups['worker_nodes'] }}" | ||
- name: Generate ISOs for the workers | ||
include_role: | ||
name: "{{ playbook_dir }}/../common-roles/download-iso" | ||
vars: | ||
cluster_name_var: "{{ cluster_name }}-day2" | ||
minimal: True | ||
final_iso_path_var: "{{ final_iso_path }}" |
Oops, something went wrong.