Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new file structure to enable module_defaults #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Fujitsu PRIMERGY servers via iRMC.
These modules and examples are intended to provide easy-to-follow and understandable solutions to manage
Fujitsu PRIMERY server settings via iRMC.

##### Version: V1.2
##### Version: V1.3

## Requirements

Expand Down Expand Up @@ -52,8 +52,6 @@ The modules were tested on RHEL 6, RHEL 7, SLES 12, SLES 15.
## Usage

Examples should be run from the root folder.
Note that the ```library``` and ```module_utiles``` folders are automatically searched by Ansible for modules when running
from playbooks.

**Example command to run irmc_facts_examples.yml:**

Expand Down Expand Up @@ -136,6 +134,7 @@ bare-metal-server provisioning tasks:
* V1.0: Initial version
* V1.1: New: iRMC FW/BIOS update, BIOS boot order, iRMC profile management
* V1.2: New: eLCM Offline/Online Update, RAID configuration
* V1.3: Add new folder structure

## License

Expand Down
19 changes: 10 additions & 9 deletions examples/boot_to_virtual_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

tasks:
- name: Get system power state
irmc_powerstate:
fujitsu.ansible.irmc_powerstate:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -45,12 +45,12 @@
delegate_to: localhost

- name: Check that server is 'Off'
fail:
ansible.builtin.fail:
msg: "Cannot continue, server is 'On'"
when: powerstate.power_state=="On"

- name: Disconnect Virtual CD
irmc_connectvm:
fujitsu.ansible.irmc_connectvm:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -59,7 +59,7 @@
delegate_to: localhost

- name: Set Virtual Media Data
irmc_setvm:
fujitsu.ansible.irmc_setvm:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -76,7 +76,7 @@
delegate_to: localhost

- name: Connect Virtual CD
irmc_connectvm:
fujitsu.ansible.irmc_connectvm:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -85,7 +85,7 @@
delegate_to: localhost

- name: Set Bios to next boot from Virtual CD
irmc_setnextboot:
fujitsu.ansible.irmc_setnextboot:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -96,20 +96,21 @@
delegate_to: localhost

- name: Get Virtual Media data
irmc_getvm:
fujitsu.ansible.irmc_getvm:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
validate_certs: "{{ validate_certificate }}"
vm_type: CDImage
register: vmdata
delegate_to: localhost

- name: Show Virtual Media data
debug:
ansible.builtin.debug:
msg: "{{ vmdata.virtual_media_data }}"

- name: PowerOn System
irmc_powerstate:
fujitsu.ansible.irmc_powerstate:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand Down
24 changes: 16 additions & 8 deletions examples/compare_server_configuration_against_saved_profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
tasks:
# Get iRMC profiles
- name: Get SystemConfig profile
irmc_profiles:
fujitsu.ansible.irmc_profiles:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -37,8 +37,9 @@
profile: "SystemConfig"
register: system_config
delegate_to: localhost

- name: Get HWConfigurationIrmc profile
irmc_profiles:
fujitsu.ansible.irmc_profiles:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -47,32 +48,39 @@
profile: "HWConfigurationIrmc"
register: hardware_config
delegate_to: localhost

- name: Show SystemConfig profile
debug:
ansible.builtin.debug:
msg: "{{ system_config.profile }}"

- name: Show HWConfigurationIrmc profile
debug:
ansible.builtin.debug:
msg: "{{ hardware_config.profile }}"

# compare iRMC Profiles to file
- name: Compare SystemConfig profile
irmc_compare_profiles:
fujitsu.ansible.irmc_compare_profiles:
profile_path1: "{{ irmc_sysconfig_file }}"
profile_json2: "{{ system_config.profile }}"
register: system_config_result
delegate_to: localhost
- fail:

- name: Fail message "SystemConfig profile differs"
ansible.builtin.fail:
msg:
- SystemConfig profile differs from saved profile
- "{{ system_config_result.comparison_list }}"
when: system_config_result.comparison_result == false

- name: Compare HWConfigurationIrmc profile
irmc_compare_profiles:
fujitsu.ansible.irmc_compare_profiles:
profile_path1: "{{ irmc_hwconfig_file }}"
profile_json2: "{{ hardware_config.profile }}"
register: hardware_config_result
delegate_to: localhost
- fail:

- name: Fail message "HWConfigurationIrmc profile differs"
ansible.builtin.fail:
msg:
- HWConfigurationIrmc profile differs from saved profile
- "{{ hardware_config_result.comparison_list }}"
Expand Down
14 changes: 8 additions & 6 deletions examples/create_new_user_and_remove_old_user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
tasks:
# Get original user account data
- name: Get original user '{{ original_user }}' account data
irmc_user:
fujitsu.ansible.irmc_user:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ original_user }}"
irmc_password: "{{ original_password }}"
Expand All @@ -39,13 +39,14 @@
name: "{{ original_user }}"
register: original_data
delegate_to: localhost

- name: Show original iRMC user details
debug:
ansible.builtin.debug:
msg: "{{ original_data.user }}"

# Create new user account
- name: "Create new user account"
irmc_user:
fujitsu.ansible.irmc_user:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ original_user }}"
irmc_password: "{{ original_password }}"
Expand Down Expand Up @@ -92,7 +93,7 @@

# Get new user account data
- name: Get new user account data
irmc_user:
fujitsu.ansible.irmc_user:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ new_user }}"
irmc_password: "{{ new_password }}"
Expand All @@ -101,13 +102,14 @@
name: "{{ new_user }}"
register: new_data
delegate_to: localhost

- name: Show original iRMC user details
debug:
ansible.builtin.debug:
msg: "{{ new_data.user }}"

# Delete original user account
- name: "Delete original user account"
irmc_user:
fujitsu.ansible.irmc_user:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ new_user }}"
irmc_password: "{{ new_password }}"
Expand Down
2 changes: 1 addition & 1 deletion examples/create_user_from_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

tasks:
- name: Create new user account
irmc_user:
fujitsu.ansible.irmc_user:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand Down
14 changes: 8 additions & 6 deletions examples/delete_all_arrays_and_create_new_array.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,21 @@

tasks:
- name: Get current RAID configuration
irmc_raid:
fujitsu.ansible.irmc_raid:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
validate_certs: "{{ validate_certificate }}"
command: "get"
register: raid
delegate_to: localhost

- name: Show current RAID configuration
debug:
ansible.builtin.debug:
msg: "{{ raid.configuration }}"

- name: Delete all RAID arrays on adapter
irmc_raid:
fujitsu.ansible.irmc_raid:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -52,7 +53,7 @@
delegate_to: localhost

- name: Create RAID array
irmc_raid:
fujitsu.ansible.irmc_raid:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -64,14 +65,15 @@
delegate_to: localhost

- name: Get new RAID configuration
irmc_raid:
fujitsu.ansible.irmc_raid:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
validate_certs: "{{ validate_certificate }}"
command: "get"
register: new
delegate_to: localhost

- name: Show new RAID configuration
debug:
ansible.builtin.debug:
msg: "{{ new.configuration }}"
10 changes: 5 additions & 5 deletions examples/elcm_offline_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

tasks:
- name: Get system power state
irmc_powerstate:
fujitsu.ansible.irmc_powerstate:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -47,12 +47,12 @@
delegate_to: localhost

- name: Check that server is 'Off'
fail:
ansible.builtin.fail:
msg: "Cannot continue, server is 'On'"
when: powerstate.power_state=="On"

- name: Configure eLCM Update Repository
irmc_elcm_repository:
fujitsu.ansible.irmc_elcm_repository:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -68,7 +68,7 @@
delegate_to: localhost

- name: Prepare eLCM Offline Update
irmc_elcm_offline_update:
fujitsu.ansible.irmc_elcm_offline_update:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -79,7 +79,7 @@
delegate_to: localhost

- name: Execute eLCM Offline Update
irmc_elcm_offline_update:
fujitsu.ansible.irmc_elcm_offline_update:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand Down
12 changes: 6 additions & 6 deletions examples/elcm_online_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

tasks:
- name: Get system power state
irmc_powerstate:
fujitsu.ansible.irmc_powerstate:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -47,12 +47,12 @@
delegate_to: localhost

- name: Check that server is 'On'
fail:
ansible.builtin.fail:
msg: "Cannot continue, server is 'Off'"
when: powerstate.power_state=="Off"

- name: Configure eLCM Update Repository
irmc_elcm_repository:
fujitsu.ansible.irmc_elcm_repository:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -68,7 +68,7 @@
delegate_to: localhost

- name: Generate eLCM Online Update List
irmc_elcm_online_update:
fujitsu.ansible.irmc_elcm_online_update:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -79,7 +79,7 @@
delegate_to: localhost

- name: Execute eLCM Online Update
irmc_elcm_online_update:
fujitsu.ansible.irmc_elcm_online_update:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand All @@ -89,7 +89,7 @@
delegate_to: localhost

- name: Delete eLCM Online Update List
irmc_elcm_online_update:
fujitsu.ansible.irmc_elcm_online_update:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
Expand Down
7 changes: 4 additions & 3 deletions examples/export_ldap_settings_to_file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,21 @@
tasks:
# Get LDAP data
- name: Get LDAP data
irmc_ldap:
fujitsu.ansible.irmc_ldap:
irmc_url: "{{ inventory_hostname }}"
irmc_username: "{{ irmc_user }}"
irmc_password: "{{ irmc_password }}"
validate_certs: "{{ validate_certificate }}"
command: "get"
register: ldap
delegate_to: localhost

- name: Show iRMC LDAP data
debug:
ansible.builtin.debug:
msg: "{{ ldap.ldap }}"

# Write LDAP settings to file
- name: Write LDAP settings to file
copy:
ansible.builtin.copy:
content: "{{ ldap.ldap }}"
dest: "{{ ldap_settings_file }}"
Loading