forked from ocp-power-automation/ocp4-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ocp tools extraction out of main.yaml (ocp-power-automation#33)
Fixes: ocp-power-automation#32 Signed-off-by: Prajyot Parab <[email protected]>
- Loading branch information
1 parent
ba81cfa
commit de6b123
Showing
2 changed files
with
57 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
|
||
- name: Set tools directory path | ||
set_fact: | ||
tools_dir: "~/ocp4_tools" | ||
|
||
- name: Create tools directory | ||
file: | ||
path: "{{ tools_dir }}" | ||
state: "{{ item }}" | ||
mode: '0755' | ||
with_items: | ||
- directory | ||
|
||
- name: Extract OCP4 tools from release image ( local-registry ) | ||
when: enable_local_registry | ||
shell: | | ||
oc adm release extract --tools {{ release_image_override }} --registry-config='{{ ansible_env.HOME }}/.openshift/pull-secret-updated' | ||
args: | ||
chdir: "{{ tools_dir }}" | ||
|
||
- name: Create pull-secret file | ||
when: not enable_local_registry | ||
copy: | ||
content: "{{ install_config.pull_secret }}" | ||
dest: "{{ tools_dir }}/pull-secret" | ||
|
||
- name: Extract OCP4 tools from release image | ||
when: not enable_local_registry | ||
shell: | | ||
oc adm release extract --tools {{ release_image_override }} --registry-config='pull-secret' | ||
args: | ||
chdir: "{{ tools_dir }}" | ||
|
||
- name: Find archive packages | ||
find: | ||
paths: "{{ tools_dir }}" | ||
patterns: "openshift-*.tar.gz" | ||
register: find_result | ||
|
||
- name: Unarchive OCP4 tool files | ||
unarchive: | ||
src: "{{ item.path }}" | ||
dest: /usr/local/bin | ||
remote_src: yes | ||
with_items: "{{ find_result.files }}" | ||
|
||
- name: Remove tools directory | ||
file: | ||
path: "{{ tools_dir }}" | ||
state: "{{ item }}" | ||
mode: '0755' | ||
with_items: | ||
- absent | ||
|
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