Skip to content

Commit

Permalink
Added changes to save HCP password,skipped pakages for rhel9 for HCP (#…
Browse files Browse the repository at this point in the history
…226)

- Updated to save the HCP password on bastion - kubadmin-password
- Fix  for creating bastion for HCP 
- Added change in hcp prerequisite installation , to skip devel packages
if rhlel version >= 9
- added change to delete the expect file after usage

---------

Signed-off-by: root <[email protected]>
Co-authored-by: root <[email protected]>
  • Loading branch information
veera-damisetti and root authored Dec 15, 2023
1 parent 31b560c commit 3d66a58
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/run-the-playbooks-for-hypershift.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ ansible-playbook playbooks/setup_for_hypershift.yaml --ask-vault-pass
* Watch Ansible as it completes the installation, correcting errors if they arise.
* To look at what tasks are running in detail, open the playbook or roles/role-name/tasks/main.yaml
* Alternatively, to run all the playbooks at once, start the master playbook by running this shell command:
* After installation , you can find the details of cluster like kubeconfig and password in the installation directory ( $HOME/ansible_workdir/ )
```
ansible-playbook playbooks/hypershift.yaml --ask-vault-pass
```
Expand Down
6 changes: 6 additions & 0 deletions roles/create_bastion_hypershift/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
recurse: true
state: directory

- name: Removing network configurations
lineinfile:
path: ../create_bastion/templates/bastion-ks.cfg.j2
state: absent
regexp: '^network*'

- name: Create bastion.ks file
template:
src: ../create_bastion/templates/bastion-ks.cfg.j2
Expand Down
5 changes: 5 additions & 0 deletions roles/create_inventory_setup_hypershift/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@
- name: Key already added
debug:
msg: "Ignore the above error if ssh-key already added"

- name: Delete expect file
file:
path: "{{ find_project.stdout }}{{ find_inventory.stdout }}/ssh-key.exp.sh"
state: absent
8 changes: 7 additions & 1 deletion roles/install_prerequisites_host_hypershift/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@
path: /root/ansible_workdir
state: directory

- name: Getting rhel version
shell: awk -F 'release ' '{print $2}' /etc/redhat-release | awk '{print $1}'
register: rhel_version

- name: Install Packages on kvm_host
yum:
name:
- "{{ item }}"
state: present
loop: "{{ env.pkgs.kvm }}"
when: host != 'bastion_hypershift'
when:
- host != 'bastion_hypershift'
- ( rhel_version.stdout| float < 9.0 ) or rhel_version.stdout| float >= 9.0 and 'devel' not in item

- name: Install Packages for Hypershift
package:
Expand Down
5 changes: 5 additions & 0 deletions roles/wait_for_hc_to_complete_hypershift/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
shell: echo "{{cluster_password_encoded.stdout_lines[0].split(' ')[-1]}}" | base64 --decode
register: cluster_password_decoded

- name: Saving the password in bastion
copy:
content: "{{ cluster_password_decoded.stdout_lines[0] }}"
dest: /root/ansible_workdir/kubeadmin-password

- name: Get api server of Hosted Cluster
shell: "cat /root/ansible_workdir/{{ hypershift.hcp.hosted_cluster_name }}-kubeconfig | grep -i server:"
register: api_server
Expand Down

0 comments on commit 3d66a58

Please sign in to comment.