Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nocturnalastro committed Sep 9, 2022
1 parent 3150ff2 commit a4acad6
Show file tree
Hide file tree
Showing 19 changed files with 97 additions and 129 deletions.
8 changes: 4 additions & 4 deletions deploy_billi.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- import_playbook: playbooks/generate_manifests.yml
- import_playbook: playbooks/generate_agent_iso.yml
- import_playbook: playbooks/boot_iso.yml
vars:
discovery_iso_name: "{{ cluster_name}}/agent.iso"
- import_playbook: playbooks/boot_iso.yml
vars:
discovery_iso_name: "{{ cluster_name }}/agent.iso"

- import_playbook: playbooks/monitor_installation.yml
- import_playbook: playbooks/monitor_billi.yml
15 changes: 14 additions & 1 deletion playbooks/generate_agent_iso.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
---
- name: Generate agent iso using BILLI
# - name: Play to populate image_hashes for relevant images
# hosts: localhost
# vars:
# destination_hosts:
# - assisted_installer
# pre_tasks:
# - name: pre-compute need to get hashes
# set_fact:
# run_get_hash: "{{ release_images_defaults | default({}) | length == 0 }}"
# roles:
# - role: get_image_hash
# when: run_get_hash

- name: Generate agent iso using BILLI
hosts: localhost
roles:
- generate_agent_iso
5 changes: 0 additions & 5 deletions playbooks/monitor_assisted_installer.yml

This file was deleted.

5 changes: 5 additions & 0 deletions playbooks/monitor_billi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- name: Monitor install process of billi
hosts: bastion
gather_facts: False
roles:
- monitor_billi
4 changes: 2 additions & 2 deletions playbooks/monitor_installation.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: Monitor install process
hosts: bastion
hosts: bastion
gather_facts: False
roles:
- monitor_assisted_installer
- monitor_billi
- monitor_kubeapi
5 changes: 0 additions & 5 deletions playbooks/monitor_kubeapi.yml

This file was deleted.

56 changes: 32 additions & 24 deletions roles/generate_agent_iso/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
# - name: Create podman auth dir
# file:
# path: "{{ config_file_path }}/containers/"
# state: directory
# mode: 0755
# recurse: true


- name: Create podman auth dir
file:
path: "{{ ansible_env.HOME }}/.docker"
state: directory
mode: 0755
recurse: true


# - name: Copy pull_secret file.
# copy:
# content: "{{ pull_secret }}"
# dest: "{{ config_file_path }}/containers/auth.json"
# mode: 0644

- name: Copy pull_secret file.
copy:
content: "{{ pull_secret }}"
Expand All @@ -31,19 +16,42 @@
XDG_RUNTIME_DIR: "{{ config_file_path }}"
REGISTRY_AUTH_FILE: "{{ config_file_path }}/containers/auth.json"
block:
- debug:
var: config_file_path
- name: Create temp_dir to store nmstateconfig
file:
path: "{{ config_file_path }}/nmstate_store"
state: directory
mode: 0755
recurse: true

# - name: Podman login to remote registry
# containers.podman.podman_login_info:
# registry: "registry.redhat.io"
- name: Copy configs to nmstate_store
copy:
src: "{{ cluster_manifest_parent_dir }}/cluster-manifests"
dest: "{{ config_file_path }}/nmstate_store"
mode: 0755
remote_src: true

- name: Generate iso
- name: Generate cluster-manifests
ansible.builtin.shell:
cmd: "{{ billi_executable }} --log-level=debug agent create cluster-manifests"
chdir: "{{ cluster_manifest_parent_dir }}"
ignore_errors: true

- name: Copy configs back to cluster-manifests
copy:
src: "{{ config_file_path }}/nmstate_store/cluster-manifests/{{ item }}"
dest: "{{ cluster_manifest_parent_dir }}/cluster-manifests/{{ item }}"
mode: 0755
remote_src: true
loop:
- infraenv.yaml
- nmstateconfig.yaml

- name: Generate ISO with agent-config
ansible.builtin.shell:
cmd: "{{ billi_executable }} --log-level=debug agent create image"
chdir: "{{ cluster_manifest_parent_dir }}"
environment:
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE: "{{ (release_images_defaults |json_query(version_filter))[0].url }}"
# environment:
# OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE: "{{ (release_images_defaults |json_query(version_filter))[0].url }}"

- name: Put discovery iso in http store
block:
Expand All @@ -53,7 +61,7 @@
recurse: yes
state: directory

- name: Create discovery directory
- name: Copy agent iso to discovery directory
ansible.builtin.copy:
src: "{{ cluster_manifest_parent_dir }}/agent.iso"
dest: "{{ download_dest_path + '/' + download_agent_dest_file }}"
Expand Down
19 changes: 10 additions & 9 deletions roles/generate_manifests/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@
- nmstateconfig.yaml.j2
- pull-secret.yaml.j2

# - name: Render agent-config templates
# template:
# src: "{{ agent_template }}"
# dest: "{{ cluster_manifest_parent_dir }}/{{ agent_template.rsplit('.', 1)[0] }}"
# mode: 0644
# trim_blocks: true
# lstrip_blocks: true
# vars:
# agent_template: agent-config.yaml.j2
- name: Render agent-config templates
template:
src: "{{ agent_template }}"
dest: "{{ cluster_manifest_parent_dir }}/{{ agent_template.rsplit('.', 1)[0] }}"
mode: 0644
trim_blocks: true
lstrip_blocks: true
vars:
agent_template: agent-config.yaml.j2
when: (use_agent_config | default(false)) | bool

- name: "Make mirror dir"
file:
Expand Down
4 changes: 1 addition & 3 deletions roles/generate_manifests/templates/agent-config.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#jinja2:trim_blocks: True, lstrip_blocks: True
apiVersion: v1alpha1
kind: AgentConfig
metadata:
labels:
cluster-name: {{ cluster_name }}
{% if billi_bootstrap_node is defined %}
rendezvousIP: {{ hostvars[billi_bootstrap_node]['ansible_host'] }}
{% endif %}
Expand All @@ -14,6 +11,7 @@ hosts:
interfaces:
- name: {{ network_config.mac_interface_map[0].logical_nic_name }}
macAddress: {{ network_config.mac_interface_map[0].mac_address }}
{# networkConfig: {{ network_config.network_yaml | to_nice_json }} #}
{% if hostvars[hostname]['installation_disk_path'] is defined %}
rootDeviceHints:
deviceName: {{ hostvars[hostname]['installation_disk_path'] }}
Expand Down
3 changes: 2 additions & 1 deletion roles/generate_manifests/templates/infraenv.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ spec:
- {{ ntp_server }}
nmStateConfigLabelSelector:
matchLabels:
cluster-name: {{ cluster_name }}
{# cluster-name: {{ cluster_name }} #}
infraenvs.agent-install.openshift.io: ""
3 changes: 2 additions & 1 deletion roles/generate_manifests/templates/nmstateconfig.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ metadata:
name: {{ node }}
namespace: openshift-machine-api
labels:
cluster-name: {{ cluster_name }}
{# cluster-name: {{ cluster_name }} #}
infraenvs.agent-install.openshift.io: ""
spec:
config:
{{ static_network_config[node].network_yaml | indent(4) }}
Expand Down
4 changes: 2 additions & 2 deletions roles/generate_manifests/templates/registries.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ unqualified-search-registries = ["registry.access.redhat.com", "docker.io"]
mirror-by-digest-only = false
[[registry.mirror]]
location = "{{ mirror_registry }}/ocp4/openshift4"
[[registry]]
{# [[registry]]
prefix = ""
location = "k8s.gcr.io/pause"
mirror-by-digest-only = false
[[registry.mirror]]
location = "{{ mirror_registry }}/k8s-gcr/pause"
location = "{{ mirror_registry }}/k8s-gcr/pause" #}
2 changes: 1 addition & 1 deletion roles/install_cluster/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ASSISTED_INSTALLER_HOST: "{{ hostvars['assisted_installer']['host'] | default(an
ASSISTED_INSTALLER_PORT: "{{ hostvars['assisted_installer']['port'] | default(8090) }}"
ASSISTED_INSTALLER_BASE_URL: "{{ secure | ternary('https', 'http') }}://{{ ASSISTED_INSTALLER_HOST }}:{{ ASSISTED_INSTALLER_PORT }}/api/assisted-install/v2"
URL_ASSISTED_INSTALLER_CLUSTER: "{{ ASSISTED_INSTALLER_BASE_URL }}/clusters/{{ cluster_id }}"

URL_ASSISTED_INSTALLER_INFRA_ENV: "{{ ASSISTED_INSTALLER_BASE_URL }}/infra-envs/{{ infra_env_id }}"
# HTTP Basic Authentication
HTTP_AUTH_USERNAME: "none"
HTTP_AUTH_PASSWORD: "none"
Expand Down
23 changes: 11 additions & 12 deletions roles/install_cluster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
no_log: True
when: install | bool == True

- name: Patch worker partition
uri:
url: "{{ URL_ASSISTED_INSTALLER_INFRA_ENV }}/hosts/{{ discovered_host.id }}/ignition"
method: GET
status_code: [200, 201]
return_content: True
register: http_reply
with_items:
- "{{ cluster.json.hosts }}"
loop_control:
loop_var: discovered_host
# - name: Patch worker partition
# uri:
# url: "{{ URL_ASSISTED_INSTALLER_INFRA_ENV }}/hosts/{{ discovered_host.id }}/ignition"
# method: GET
# status_code: [200, 201]
# return_content: True
# register: http_reply
# with_items:
# - "{{ cluster.json.hosts }}"
# loop_control:
# loop_var: discovered_host

- name: Patch cluster with config vars relevant to the selected HA mode
when: (install | bool == True)
Expand Down Expand Up @@ -222,4 +222,3 @@
until: cluster.json.status in cluster_installation_states
retries: 5
delay: 60

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,19 @@
set_fact:
infra_env_id: "{{ infra_envs_reply.json[0].id }}"

- name: Patch hostname
ansible.builtin.include_tasks:
file: patch_hostname.yml
loop: "{{ cluster_hosts.json }}"
loop_control:
loop_var: discovered_host
# - name: Patch hostname and role
# ansible.builtin.include_tasks:
# file: patch_hostname.yml
# loop: "{{ cluster_hosts.json }}"
# loop_control:
# loop_var: discovered_host

- name: Wait for bootstrap complete
ansible.builtin.shell:
cmd: "{{ billi_executable }} --log-level=debug agent wait-for bootstrap-complete"
chdir: "{{ cluster_manifest_parent_dir }}"

- name: Wait for install complete
ansible.builtin.shell:
cmd: "{{ billi_executable }} --log-level=debug agent wait-for install-complete"
chdir: "{{ cluster_manifest_parent_dir }}"
10 changes: 0 additions & 10 deletions roles/monitor_kubeapi/defaults/main.yml

This file was deleted.

43 changes: 0 additions & 43 deletions roles/monitor_kubeapi/tasks/main.yml

This file was deleted.

0 comments on commit a4acad6

Please sign in to comment.