|
1 | 1 | --- |
2 | | -- name: Create a temporary file |
3 | | - tempfile: |
4 | | - state: file |
5 | | - register: tempfile_pullsecret |
6 | | - |
7 | | -- name: Copy pull secret to file |
8 | | - copy: |
9 | | - content: "{{ pull_secret }}" |
10 | | - dest: "{{ tempfile_pullsecret.path }}" |
11 | | - |
12 | | -- name: Create cluster and download ISO |
13 | | - block: |
14 | | - - name: Create new AI cluster |
15 | | - shell: "aicli create cluster -P pull_secret={{ tempfile_pullsecret.path }} -P base_dns_domain={{ cluster_domain }} -P ssh_public_key='{{ ssh_public_key }}' -P high_availability_mode=None -P openshift_version='{{ cluster_version }}' {{ cluster_name }}" |
16 | | - |
17 | | - - name: Retrieve cluster ID from name |
18 | | - shell: "aicli list cluster | grep {{ cluster_name }} | cut -d '|' -f3 | tr -d ' '" |
19 | | - register: cluster_id |
20 | | - |
21 | | - - name: Set the right network type |
22 | | - uri: |
23 | | - url: "{{ ai_url }}/api/assisted-install/v1/clusters/{{ cluster_id.stdout }}/install-config" |
24 | | - method: PATCH |
25 | | - body: '"{\"networking\": {\"networkType\": \"{{ cluster_sdn | default("OVNKubernetes") }}\"}}"' |
26 | | - body_format: json |
27 | | - status_code: 201 |
28 | | - |
29 | | - - name: Copy the network file remotely if it exists |
30 | | - copy: |
31 | | - src: "{{ network_config_path }}" |
32 | | - dest: "{{ temporary_path }}/network_config" |
33 | | - when: network_config_path is defined and network_config_path|length>0 |
34 | | - |
35 | | - - name: Download the small ISO |
36 | | - shell: "aicli create iso --minimal -P ssh_public_key='{{ ssh_public_key}}' {% if network_config_path is defined and network_config_path|length > 0 %}--paramfile {{ temporary_path }}/network_config{% endif %} {{ cluster_name }}" |
37 | | - |
38 | | - - name: And download it |
39 | | - shell: "aicli download iso {{ cluster_name }} -p {{ final_iso_path }}" |
40 | | - |
41 | | - environment: |
42 | | - AI_URL: "{{ ai_url }}" |
43 | | - |
| 2 | +- name: create cluster |
| 3 | + include_role: |
| 4 | + name: "{{ playbook_dir }}/../common-roles/create-cluster" |
| 5 | + vars: |
| 6 | + extra_args: "-P high_availability_mode=None" |
| 7 | + cluster_name_var: "{{ cluster_name }}" |
| 8 | + |
| 9 | +- name: download ISO |
| 10 | + include_role: |
| 11 | + name: "{{ playbook_dir }}/../common-roles/download-iso" |
| 12 | + vars: |
| 13 | + cluster_name_var: "{{ cluster_name }}" |
| 14 | + final_iso_path_var: "{{ final_iso_path }}" |
| 15 | + minimal: True |
0 commit comments