https://github.com/fujitsu/ism-ansible
Ansible Modules and Sample Playbooks for Fujitsu Software Infrastructure Manager
https://github.com/fujitsu/ism-ansible
Last synced: 6 months ago
JSON representation
Ansible Modules and Sample Playbooks for Fujitsu Software Infrastructure Manager
- Host: GitHub
- URL: https://github.com/fujitsu/ism-ansible
- Owner: fujitsu
- License: gpl-3.0
- Created: 2017-12-01T06:12:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-03-05T04:36:28.000Z (over 5 years ago)
- Last Synced: 2023-02-28T06:23:47.306Z (over 3 years ago)
- Language: Python
- Homepage:
- Size: 242 KB
- Stars: 10
- Watchers: 8
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Ansible Modules for Infrastructure Manager
This is the modules to manage Infrastructure Manager using Ansible playbooks.
## Requirements
- Ansible Server
- Ansible 2.4 or later
- Python 2.6 or later
- FUJITSU Software Infrastructure Manager
- 2.2.0 or later
## Examples
Sample playbooks and instructions on how to run the modules can be found in the examples directory.
## Setup
To run the Ansible modules and sample playbooks provided in this project, you should execute the following steps:
### 1. Clone the repository
Run on the Ansible Server:
```shell
cd /etc/ansible
git clone https://github.com/fujitsu/ism-ansible.git
```
### 2. Configure the ANSIBLE_LIBRARY environmental variable
Set the environment variables `ANSIBLE_LIBRARY` and `ANSIBLE_MODULE_UTILS`, `PYTHONPATH`, specifying the library full path from the cloned project.
Run on the Ansible Server:
```shell
export ANSIBLE_LIBRARY=/etc/ansible/ism-ansible/library
export ANSIBLE_MODULE_UTILS=/etc/ansible/ism-ansible/library/module_utils/
export PYTHONPATH=$PYTHONPATH:$ANSIBLE_LIBRARY
```
### 3. Certificate assignment for Infrastructure Manager
Acquire the certificate used for https communication and assign in the Ansible server.
For information on how to assign certificates, refer to "3.1.1 Preparation" in
"FUJITSU Software Infrastructure Manager V2.2 REST API Reference Manual".
### 4. Setting config file
Set the account information of Infrastructure Manager for the confg file (`ism_config.json`).
Execute `config_setting.sh` with Ansible server as follows.The config file is created in the current directory when executing it.
Refer from [[Note1]](#note-1) to [[Note5]](#note-5).
#### Example
```shell
$ cd /etc/ansible/ism-ansible/
$ chmod +x ./config_setting.sh
$ ./config_setting.sh
> Enter IP address or FQDN:
or
> Enter port number:
> Enter user name:
> Enter password:
> Enter full path of certificate file:
> completed
```
In each example in the above < >, specify the information of Infrastructure Manager.
Refer to [[Note6]](#note-6).
Confirm the config file was created.
#### Example of execution with IP address
```shell
$ cat ./ism_config.json
{"ip":"192.168.1.10","portNo":"25566",
"credentials":{"userName":"administrator",
"password":"U2FsdGVkX18iGtLsngKkgWtQQ3+j0s5W1aSTizoWny8="},
"certificate": "/etc/ansible/ism-ansible/certificate.crt"}
```
Describe the path of the config file in playbook.
Refer to [[Note7]](#note-7) and [[Note8]](#note-8).
#### Playbook example
```yaml
- name: Firmware update
hosts: servers
connection: local
tasks:
- name: Execution of ism_firmware_update
ism_firmware_update:
config: "/etc/ansible/ism-ansible/ism_config.json"
```
### 5. Setting inventory file
The inventory file describes the IP address (OS, hardware) and hostname (OS, hardware) of the operation target node.
Specify the operation target for the inventory file.
Allocate the inventory file in Ansible server.
#### INI Format
```INI
[]
ism_profile_name=
ism_node_name= ism_node_type= ism_node_model=
ism_profile_name= ism_computer_name= ism_os_ip_address=
...
[]
```
#### YAML Format
```YAML
all:
children:
:
hosts:
:
ism_profile_name:
:
ism_node_name:
ism_node_type:
ism_node_model:
:
ism_profile_name:
ism_computer_name:
ism_os_ip_address:
:
...
:
hosts:
:
```
#### Settings
Name
Value
Remarks
Host group name
Any host group name
Specifies an arbitrary host group name.
The host group is defined the multiple hosts as one group.
In Ansible, the playbook can be executed for the host group unit.
Operation target node
One of the following
- IP address
- Host name (FQDN)
Multiple specifications are available.
Specifies the IP address of the operation target node registered in Infrastructure Manager or the host name (FQDN) for its IP address.
When the OS information of the operation target node is registered in Infrastructure Manager, the host name (FQDN) for the IP address of the OS information or the IP address can be specified.
[Note9] [Note10] [Note11]
Profile name
The name of the profile to apply to the operation target node.
Or, the new profile name when you copy the profile.
Optional.
Specifies to run the profile assignment, copy profile module.
Otherwise, it is ignored.
If omitted, no key part ("ism_profile_name=", "ism_profile_name:") should be specified.
OS IP Address
The OS IP address to specify when copying the profile
Optional.
Specifies to run the copy profile module.
Otherwise, it is ignored.
If omitted, no key part ("ism_os_ip_address=","ism_os_ip_address:") should be specified.
Computer name
Computer name to specify when copying the profile
Optional.
Specifies to run the copy profile module.
Otherwise, it is ignored.
If omitted, no key part ("ism_computer_name=","ism_computer_name:") should be specified.
Operation target server
One of the following
- IP address
- Host name (FQDN)
Specifies the IP address of the ISM server or the hostname (FQDN) for its IP address.
Use this value when performing unique operations with ISM, such as updating downloadable firmware information.
Node name
The name of the node to be registered with the operation target node
Optional.
Specifies to run the node registration module.
It is ignored for modules other than node registration.
If omitted, no key part ("ism_node_name=","ism_node_name:") should be specified.
Node type
Node type to be registered in the operation target node
Optional
Specifies to run the node registration module.
It is ignored for modules other than node registration.
If omitted, no key part ("ism_node_type=","ism_node_type:") should be specified.
Model name
Model name to be registered in the operation target node
Optional.
Specifies to run the node registration module.
It is ignored for modules other than node registration.
If omitted, no key part ("ism_node_model=","ism_node_model:") should be specified.
#### Character code
UTF-8
#### File Location
Anywhere on the management server(Ansible).
#### Example
- Host group name: servers
- Operation node1
- IP address of OS information: 192.168.1.11
- Profile name: profileA
- Operation node2
- Node IP address: 192.168.1.12
- Operation node3
- Host name for IP address of OS information: node3-os.test.local
- Operation node4
- Host name for IP address of node: node4
- Operation node5
- Node IP address: 192.168.1.13
- Profile name: profileB
- Computer name: node5
- Host name for IP address of OS information: 192.168.1.23
- Host group name: ism_server
- Operation server: 192.168.1.10
##### INI Format
```INI
[servers]
192.168.1.11 ism_profile_name=profileA
192.168.1.12 ism_node_name=nodeA ism_node_type=server ism_node_model="PRIMERGY RX300S8"
node3-os.test.local
node4
192.168.1.13 ism_profile_name=profileB ism_computer_name=node5 ism_os_ip_address=192.168.1.23
[ism_server]
192.168.1.10
```
##### YAML Format
```YAML
all:
children:
servers:
hosts:
192.168.1.11:
ism_profile_name: profileA
192.168.1.12:
ism_node_name: node_A
ism_node_type: server
ism_node_model: PRIMERGY RX300 S8
node3-os.test.local:
node4:
192.168.1.13:
ism_profile_name: profileB
ism_computer_name: node5
ism_os_ip_address: 192.168.1.23
ism_server:
hosts:
192.168.1.10:
```
### 6. Modules and license check
The following is a list of modules available and unavailable in Essential.
Module name
Operation Mode [Note13]
Other than Essential [Note14]
Essential
ism_backup.py
Yes
Yes
ism_copy_profile.py
Yes
No
ism_download_firmware.py
Yes
Yes
ism_firmware_list.py
Yes
Yes
ism_firmware_update.py
Yes
Yes
ism_get_download_firmware_list.py
Yes
Yes
ism_get_inventory_info.py
Yes
Yes
ism_get_power_status.py
Yes
Yes
ism_get_profile_info.py
Yes
No
ism_get_report_info.py
Yes
Yes
ism_maintenance_mode_setting.py
Yes
Yes
ism_power_on.py
Yes
Yes
ism_profile_assignment.py
Yes
No
ism_refresh_node_info.py
Yes
Yes
ism_retrieve_download_firmware_info.py
Yes
Yes
Yes:Available
No:Unavailable
[[Note15]](#note-15)
### 7. Playbook execution
The following commands are executed with Ansible server.
```shell
ansible-playbook -i
```
#### Example
playbook file path: `/etc/ansible/ism-ansible/examples/ism_firmware_list.yml`
inventory file path: `/etc/ansible/hosts`
```shell
ansible-playbook /etc/ansible/ism-ansible/examples/ism_firmware_list.yml -i /etc/ansible/hosts
```
## Report information comparison tool
A tool that compares the output files of the report information retrieval module.
### Deployment path
By default, it is placed in the following path:
\/ism-ansible/tools/ism_report_diff.py
### Tool execution command
```shell
python ism_report_diff.py []
```
### Options
Parameter
Required
Description
FILE1
Yes
Specifies an old report information file to be compared.
FILE2
No
Specifies a new report information file to compare with.
If this parameter is omitted, FILE1 and FILE2 are not compared and only the information of the file specified in FILE1 is output.
### Examples
- To compare the old and new report information files
```shell
python ism_report_diff.py 2019-11-04_14-35-31.json 2019-12-04_09-01-02.json
```
- To output the information of only FILE1 without comparison
```shell
python ism_report_diff.py 2019-12-04_09-01-02.json
```
### Output
Name
Description
Total
Number of nodes registered in ISM.
Diff
Number of nodes added and deleted by comparing the old and new report information files
[Note16]
Format:
+<Number of adding nodes>, -<Number of deleting nodes>
Example: Adding two nodes and deleting one node
+2, -1
Status
Number of nodes in each status.
Error
Number of nodes that the status is Error.
Warning
Number of nodes that the status is Warning.
Unknown
Number of nodes that the status is Unknown.
Updating
Number of nodes that the status is Updating.
Normal
Number of nodes that the status is Normal.
Alarm status
Number of nodes in each alarm status
Error
Number of nodes that the alarm status is Error.
Warning
Number of nodes that the alarm status is Warning.
Info
Number of nodes that the alarm status is Info.
Normal
Number of nodes that the alarm status is Normal.
Added node
Added node information for old and new report information files
Node <N>
Node Information
<N> is an integer, starting with 1
Name
Node name
Type
Node type
Model
Model name
IP
IP address
Displays None for nodes that do not have an IP address
Firmware
Firmware Information that can be updated.
If there is no firmware that can be updated, it will not be output.
Node <N>
Node Information where existing the updatable firmware.
<N> is an integer, starting with 1
Name
Node name
Type
Node type
Model
Model name
IP
IP address
Displays None for nodes that do not have an IP address.
Firmware <N>
Currently applied firmware information.
<N> is an integer, starting with 1
Name
Firmware name
Type
Firmware type
Version
Version
Updatable firmware <N>
Firmware information that can be updated
<N> is an integer, starting with 1
Name
Firmware Name
Type
Firmware type
Version
Version
RepositoryName
Repository
OperationMode
Supported mode
### Notes
- Sample playbook using ism_report_diff.py
[examples/ism_diff_report.yml](/examples/ism_diff_report.yml)
## Changing processing time of Update Firmware and Profile Assignment settings
In the module of Update Firmware or Profile Assignment, waiting to complete the task in the internal processing.
The timeout period for the process of waiting to complete the task can be changed with the following ism_user_settings file.
Refer to [[Note12]](#note-12).
ism_user_settings file path: `/etc/ansible/ism-ansible/module_utils/ism_user_settings.py`
### Example
Timeout period of firmware update: `14400` (second) (= 4hours)
Timeout period of application of profile: `18000` (second) (= 5hours)
```python
#!/usr/bin/python
#coding: UTF-8
# user_settings_value
'''
Set time confirmation for task confirmation
'''
FIRMWARE_UPDATE_TIME_OUT = 14400
PROFILE_ASSIGNMENT_TIME_OUT = 18000
```
## Notes
[Note1]
When the config file already exists, it will be overwritten.
Example (For FQDN ism.test.local):
```shell
$ ./ism-ansible/config_setting.sh
Enter IP address or FQDN:
ism.test.local
Traceback (most recent call last):
File "", line 1, in
socket.gaierror: [Errno -2] Name or service not known
```
[Note13]
This is the "Operation Mode" value output by "ismadm license show" command.
[Note14]
The "Operation Mode" other than Essential are as follows.
- Advanced
- Advanced (Trial)
- Advanced for PRIMEFLEX
- Advanced for PRIMEFLEX (Trial)
- NFLEX
- NFLEX (Trial)
[Note16]
Output only if FILE2 is specified as a tool option.
## Software support
The software in this project is not supported.
## License
This project is licensed under the GPL v3 license. See the [LICENSE](LICENSE) for more information.
## Copyright
Copyright FUJITSU LIMITED 2017-2020
## API
- FUJITSU Software Infrastructure Manager REST API Reference Manual