Skip to content

Commit 5977599

Browse files
Yolanda Roblayrobla
authored andcommitted
Reconcile latest changes with SNO
Use the common roles to execute regular tasks, to avoid duplicates Signed-off-by: Yolanda Robla <yroblamo@redhat.com>
1 parent df92f19 commit 5977599

File tree

7 files changed

+64
-78
lines changed

7 files changed

+64
-78
lines changed

ai-deploy-cluster-singlenode/inventory/hosts.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ final_iso_path=/var/www/html
4848
# final_iso_path=/home/share/
4949
# need_racadm=false
5050

51+
# if virtualmedia is done over http
52+
virtualmedia_over_http=True
53+
5154
### Network config (uncomment for static setting, or leave commented for DHCP)
5255
# it needs to follow nmstate format
5356
# network_config_path=./sample/worker_sno.yaml
Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,15 @@
11
---
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

ai-deploy-cluster-singlenode/roles/deploy-cluster/tasks/main.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
---
2-
- name: Configure cluster
2+
- name: Configure host
33
block:
4-
- block:
5-
- name: Query for the host ID, there is only one as is SNO
6-
shell: "aicli list hosts | grep {{ cluster_name }} | cut -d '|' -f 4"
7-
register: host_id
8-
when: hostname is defined
9-
10-
- name: Set the hostname for the given host_id
11-
shell: "aicli update host {{ host_id.stdout | trim }} -P name={{ hostname }}"
12-
when: host_id | length > 0
4+
- name: Query for the host ID, there is only one as is SNO
5+
shell: "aicli list hosts | grep {{ cluster_name }} | cut -d '|' -f 4"
6+
register: host_id
137
when: hostname is defined
148

9+
- name: Set the hostname for the given host_id
10+
shell: "aicli update host {{ host_id.stdout | trim }} -P name={{ hostname }}"
11+
when: host_id | length > 0
12+
when: hostname is defined
13+
environment:
14+
AI_URL: "{{ ai_url }}"
15+
16+
- name: Configure cluster
17+
block:
1518
- name: Wait until cluster is ready to be installed
1619
shell: "aicli list cluster | grep {{ cluster_name }} | cut -d '|' -f4 | tr -d ' '"
1720
register: cluster_ready

ai-deploy-cluster-singlenode/roles/prepare-environment/tasks/main.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,12 @@
55
- podman
66
- openssl-devel
77
- make
8-
- httpd
98
state: present
109

11-
- name: make sure httpd landing page is disabled
12-
copy:
13-
content: "# Disabled"
14-
dest: /etc/httpd/conf.d/welcome.conf
15-
force: yes
16-
group: root
17-
owner: root
18-
mode: 0644
19-
20-
- name: Enable and (re)start httpd
21-
systemd:
22-
name: httpd
23-
enabled: yes
24-
masked: no
25-
state: restarted
10+
- name: install httpd
11+
include_role:
12+
name: "{{ playbook_dir }}/../common-roles/install-httpd"
13+
when: virtualmedia_over_http is defined and virtualmedia_over_http|bool == True
2614

2715
- name: Set openshift_versions json dict
2816
ansible.builtin.set_fact:
@@ -31,18 +19,18 @@
3119
"display_name": "{{ display_name }}",
3220
"rhcos_image": "{{ rhcos_image }}",
3321
"rhcos_version": "{{ rhcos_version }}",
34-
"support_level": "{{ support_level }}"}}'
22+
"support_level": "{{ support_level | default("beta") }}"
23+
}
24+
}'
25+
3526
- name: Set openshift_versions json object
3627
ansible.builtin.set_fact:
3728
openshift_versions: "{{ openshift_versions_dict | to_json }}"
29+
3830
- name: Set rhcos_base_iso to rhcos_image to avoid duplication
3931
ansible.builtin.set_fact:
4032
rhcos_base_iso: "{{ rhcos_image }}"
4133

42-
- name: install ISO generator scripts
43-
include_role:
44-
name: "{{ playbook_dir }}/../common-roles/install-iso-generator"
45-
4634
- name: install racadm
4735
include_role:
4836
name: "{{ playbook_dir }}/../common-roles/install-racadm"
@@ -64,5 +52,3 @@
6452
- "OPENSHIFT_INSTALL_RELEASE_IMAGE={{ sno_image }}"
6553
- "PUBLIC_CONTAINER_REGISTRIES=quay.io,registry.svc.ci.openshift.org"
6654
- "RHCOS_BASE_ISO={{ rhcos_base_iso }}"
67-
68-

common-roles/download-iso/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
when: network_config_path is defined and network_config_path|length>0
1313

1414
- name: Create the small ISO
15-
shell: "aicli create iso {% if minimal is defined and minimal | bool == True%}--minimal{% endif %} -P ssh_public_key='{{ ssh_public_key}}' --paramfile {% if network_config_path is defined and network_config_path|length > 0 %}{{ temporary_path }}/network_config{% endif %} {{ cluster_name_var }}"
15+
shell: "aicli create iso {% if minimal is defined and minimal | bool == True%}--minimal{% endif %} -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_var }}"
1616

1717
- name: And download it
1818
shell: "aicli download iso {{ cluster_name_var }} -p {{ final_iso_path_var }}"

common-roles/install-assisted-installer/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- name: Clone the assisted installer project
22
git:
33
repo: 'https://github.com/openshift/assisted-service'
4-
version: "{{ ai_version }}"
4+
version: "{{ ai_version | default('HEAD') }}"
55
dest: /opt/assisted-service-ztp
66
update: yes
77
force: yes
@@ -35,7 +35,7 @@
3535
chdir: "/opt/assisted-service-ztp"
3636

3737
- name: Start the assisted installer service
38-
shell: "ASSISTED_TAG={{ assisted_tag }} make deploy-onprem"
38+
shell: "ASSISTED_TAG={{ assisted_tag | default('latest') }} make deploy-onprem"
3939
args:
4040
chdir: "/opt/assisted-service-ztp"
4141
environment:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
- name: Install httpd package
3+
yum:
4+
name:
5+
- httpd
6+
state: present
7+
8+
- name: make sure httpd landing page is disabled
9+
copy:
10+
content: "# Disabled"
11+
dest: /etc/httpd/conf.d/welcome.conf
12+
force: yes
13+
group: root
14+
owner: root
15+
mode: 0644
16+
17+
- name: Enable and (re)start httpd
18+
systemd:
19+
name: httpd
20+
enabled: yes
21+
masked: no
22+
state: restarted

0 commit comments

Comments
 (0)