forked from IBM/Ansible-OpenShift-Provisioning
-
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.
chore: Changed dir structure for role boot from ftp
Signed-off-by: Klaus Smolin <[email protected]>
- Loading branch information
Showing
3 changed files
with
58 additions
and
47 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,46 @@ | ||
--- | ||
|
||
- name: Boot LPAR node using boot from ftp function | ||
block: | ||
- name: Define local variables | ||
ansible.builtin.set_fact: | ||
_hmc_load_from_ftp_file_path: "{{ parm_lpar_prm_files[idx] }}" | ||
|
||
- name: Create temporary config file | ||
ansible.builtin.tempfile: | ||
state: file | ||
suffix: temp | ||
register: _config_yaml_tempfile | ||
|
||
- name: Create HMC load from ftp config file from template | ||
ansible.builtin.template: | ||
src: "hmc_load_from_ftp.j2" | ||
dest: "{{ _config_yaml_tempfile.path }}" | ||
mode: u=rw,g=r,o=r | ||
force: true | ||
|
||
- name: Execute HMC load from ftp function | ||
ansible.builtin.shell: | | ||
set -e | ||
{{ role_path }}/files/hmc_load_from_ftp.py "{{ _config_yaml_tempfile.path }}" | ||
# Delete tempfile | ||
rm -f "{{ _config_yaml_tempfile.path }}" | ||
register: cmd_output | ||
|
||
- name: Execute HMC load from ftp function - command output | ||
ansible.builtin.debug: | ||
var: cmd_output | ||
|
||
rescue: | ||
- name: Cleanup on error | ||
block: | ||
- name: Cleanup on error | ||
ansible.builtin.shell: | | ||
# cat "{{ _config_yaml_tempfile.path }}" | ||
# Delete tempfile | ||
rm -f "{{ _config_yaml_tempfile.path }}" | ||
register: cmd_output | ||
|
||
- name: Cleanup on error - command output | ||
ansible.builtin.debug: | ||
var: cmd_output |
Empty file.
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 |
---|---|---|
@@ -1,55 +1,20 @@ | ||
--- | ||
|
||
- name: Check role/task parameters | ||
ansible.builtin.fail: | ||
msg: "Error: loop control variable 'idx' is not defined" | ||
when: idx is not defined | ||
|
||
- name: Boot LPAR node using boot from ftp function | ||
block: | ||
- name: Include LPAR host variablese | ||
ansible.builtin.include_vars: | ||
file: "{{ inventory_dir }}/host_vars/{{ parm_lpar_names[idx] }}.yaml" | ||
name: _node | ||
|
||
- name: Define local variables | ||
ansible.builtin.set_fact: | ||
_hmc_load_from_ftp_file_path: "{{ parm_lpar_prm_files[idx] }}" | ||
|
||
- name: Create temporary config file | ||
ansible.builtin.tempfile: | ||
state: file | ||
suffix: temp | ||
register: _config_yaml_tempfile | ||
|
||
- name: Create HMC load from ftp config file from template | ||
ansible.builtin.template: | ||
src: "hmc_load_from_ftp.j2" | ||
dest: "{{ _config_yaml_tempfile.path }}" | ||
mode: u=rw,g=r,o=r | ||
force: true | ||
|
||
- name: Execute HMC load from ftp function | ||
ansible.builtin.shell: | | ||
set -e | ||
{{ role_path }}/files/hmc_load_from_ftp.py "{{ _config_yaml_tempfile.path }}" | ||
# Delete tempfile | ||
rm -f "{{ _config_yaml_tempfile.path }}" | ||
register: cmd_output | ||
|
||
- name: Execute HMC load from ftp function - command output | ||
ansible.builtin.debug: | ||
var: cmd_output | ||
- name: Include LPAR host variablese | ||
ansible.builtin.include_vars: | ||
file: "{{ inventory_dir }}/host_vars/{{ parm_lpar_names[idx] }}.yaml" | ||
name: _node | ||
|
||
rescue: | ||
- name: Cleanup on error | ||
block: | ||
- name: Cleanup on error | ||
ansible.builtin.shell: | | ||
# cat "{{ _config_yaml_tempfile.path }}" | ||
# Delete tempfile | ||
rm -f "{{ _config_yaml_tempfile.path }}" | ||
register: cmd_output | ||
- name: Lood classic mode task | ||
when: 1 | ||
ansible.builtin.include_tasks: "classic_mode.yaml" | ||
|
||
- name: Cleanup on error - command output | ||
ansible.builtin.debug: | ||
var: cmd_output | ||
- name: Lood dpm mode task | ||
when: 0 | ||
# _node.cpc_dpm_mode is defined and _node.cpc_dpm_mode | ||
ansible.builtin.include_tasks: "dpm_mode.yaml" |