Giter Site home page Giter Site logo

imc-ansible's People

Contributors

dsoper2 avatar nikolay-fedotov avatar vvb avatar waghswapnil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imc-ansible's Issues

vmedia_mount_remove_all can't handle saved vmedia mappings

If a CIMC has a saved but inactive vmedia mapping, vmedia_mount_remove_all will throw the following exception:

[2018-03-26 10:00:02] 10.23.223.248 Caught an exception: Traceback (most recent call last): File "/home/jlothian/src/cimc-cli/cimc_cli/firmwarecommands.py", line 22, in upgrade_firmware result = firmware.upgrade(handle, location) # FW upgrades either work, or raise an Exception File "/home/jlothian/src/cimc-cli/cimc_cli/firmware.py", line 46, in upgrade vmedia_mount_remove_all(handle) File "/home/jlothian/.virtualenvs/cimc-cli/local/lib/python2.7/site-packages/imcsdk/apis/server/vmedia.py", line 409, in vmedia_mount_remove_all handle.remove_mo(virt_media) File "/home/jlothian/.virtualenvs/cimc-cli/local/lib/python2.7/site-packages/imcsdk/imchandle.py", line 484, in remove_mo self._commit(timeout=timeout) File "/home/jlothian/.virtualenvs/cimc-cli/local/lib/python2.7/site-packages/imcsdk/imchandle.py", line 517, in _commit response = self.post_elem(elem, timeout=timeout) File "/home/jlothian/.virtualenvs/cimc-cli/local/lib/python2.7/site-packages/imcsdk/imcsession.py", line 287, in post_elem response = xc.from_xml_str(response_str, self) File "/home/jlothian/.virtualenvs/cimc-cli/local/lib/python2.7/site-packages/imcsdk/imcxmlcodec.py", line 91, in from_xml_str raise ex.ImcException(error_code, error_descr) ImcException: [ErrorCode]: ERR-xml-parse-error[ErrorDescription]: XML PARSING ERROR: Element 'commSavedVMediaMap': The attribute 'adminAction' is required but missing.

This is on 0.9.3.0.

When tried to run configuring ntp task twice, second time also, 'changed' value is shown as 1

Execute the task twice -

tasks:
    - name: configure ntp servers
      cisco_imc_ntp:
        state: present
        ntp_servers:
          - {'id': '1', 'ip': '1.1.1.1'}
          - {'id': '2', 'ip': '2.2.2.2'}
          - {'id': '3', 'ip': '3.3.3.3'}
        ip: '{{ imc_ip }}'
        username: '{{ imc_username }}'
        password: '{{ imc_password }}'

After running the second time, below is the output -

ansible-playbook -i inventory create_config/test_create_ntp.yml 

PLAY [imc] **********************************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************
ok: [classic_imc16]

TASK [configure ntp servers] ****************************************************************************************************************************
changed: [classic_imc16]

PLAY RECAP **********************************************************************************************************************************************
classic_imc16              : ok=2    changed=1    unreachable=0    failed=0 

The changed value should be 0 and not 1.

Convert license to GPLv3 and include by default in Ansible

In order for joint customers to fully benefit from these modules, having them built-into the Ansible distribution is ideal. Unfortunately, this requires modules being of type license GPLv3. This would be a good idea since most all Cisco networking modules are GPLv3 and are already included in the base Ansible release by default, or are in progress.

Some more info on submitting modules to Ansible:
https://docs.ansible.com/ansible/dev_guide/developing_modules_in_groups.html

Connectivity to CIMC with version 3.0(1c) is broken

Connectivity works to version 2.x of CIMC but NOT to 3.x.
The followign error is thrown:

fatal: [CIMC-istreamer3a-etn]: FAILED! => {"changed": false, "failed": true, "msg": "<urlopen error [Errno 104] Connection reset by peer>"

fatal: [CIMC-istreamer1a-etn]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"ip": "CIMC-istreamer1a-etn", "ntp_servers": [{"id": "1", "ip": "10.216.2.101"}, {"id": "2", "ip": "10.216.2.102"}, {"id": "3", "ip": ""}, {"id": "4", "ip": ""}], "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": null, "proxy": null, "secure": null, "server": null, "state": "present", "username": "admin"}, "module_name": "cisco_imc_ntp"}, "msg": "<urlopen error [Errno 104] Connection reset by peer>"}

Task running 'cisco_imc_server' module throws error

Execute the below task -

tasks:
    - name: server power off
      cisco_imc_server:
        state: off
        ip: '{{ imc_ip }}'
        username: '{{ imc_username }}'
        password: '{{ imc_password }}'

Observed below error -

ansible-playbook -i inventory create_config/test_create_server_actions.yml 

PLAY [imc] **********************************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************
ok: [classic_imc16]

TASK [server power off] *********************************************************************************************************************************
fatal: [classic_imc16]: FAILED! => {"changed": false, "failed": true, "msg": "setup error: 'status' "}
	to retry, use: --limit @/home/winadmin/test_playbooks_imc/create_config/test_create_server_actions.retry

PLAY RECAP **********************************************************************************************************************************************
classic_imc16              : ok=1    changed=0    unreachable=0    failed=1

cisco_imc_login doesn't return anything other than successful login.

Just did a bit of research on this for my needs:

  • assuming you use the cisco_imc_login .. you'd want at least a cookie passed back to use on subsequent calls
  • right the server handle which is returned is not serializable in JSON.. the cookie would be
  • IMCSDK has not facilities in imchandle for this.. tho we should be able to pass the cookie and validtate it's usable if we get it.. and refresh.

ansible-doc -l functionality is broken

After installing this module you cannot use the ansible-doc -l command:
[ERROR]: unable to parse /usr/local/lib/python2.7/site-packages/ansible/modules/extras/server/cisco/cisco_imc_boot_order_precision.py
ERROR! module cisco_imc_boot_order_precision has a documentation error formatting or is missing documentation

[ERROR]: unable to parse /usr/local/lib/python2.7/site-packages/ansible/modules/extras/server/cisco/cisco_imc_password_policy.py
ERROR! module cisco_imc_password_policy has a documentation error formatting or is missing documentation

"'ascii' codec can't decode byte 0xc3 in position 32: ordinal not in range(128)"

Hi, I'm working whit the snmp_trap handle and Im getting the following error:

`The full traceback is:
File "/tmp/ansible_dOZXfU/ansible_modlib.zip/ansible/module_utils/cisco_imc.py", line 39, in login
server.login()
File "/usr/local/lib/python2.7/dist-packages/imcsdk-0.9.5-py2.7.egg/imcsdk/imchandle.py", line 143, in login
return self._login(auto_refresh=auto_refresh, force=force, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/imcsdk-0.9.5-py2.7.egg/imcsdk/imcsession.py", line 581, in _login
response = self.post_elem(elem, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/imcsdk-0.9.5-py2.7.egg/imcsdk/imcsession.py", line 283, in post_elem
response_str = self.post_xml(xml_str, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/imcsdk-0.9.5-py2.7.egg/imcsdk/imcsession.py", line 234, in post_xml
response_str = self.post(uri=imc_uri, data=xml_str, read=read, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/imcsdk-0.9.5-py2.7.egg/imcsdk/imcsession.py", line 210, in post
response = self.__driver.post(uri=uri, data=data, read=read, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/imcsdk-0.9.5-py2.7.egg/imcsdk/imcdriver.py", line 262, in post
if "Connection reset by peer".lower() in str(e).lower():

fatal: [compute45]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"hostname": "10.92.97.206",
"ip": "10.4.20.54",
"notification_type": "traps",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": "162",
"proxy": null,
"secure": null,
"server": null,
"state": "present",
"user": null,
"username": "admin",
"version": "2"
}
},
"msg": "'ascii' codec can't decode byte 0xc3 in position 32: ordinal not in range(128)"
}
`

This is my playboook
`---

  • hosts: test
    connection: local
    gather_facts: no
    tasks:
    • name: enable SNMP Traps
      cisco_imc_snmp_trap:
      hostname: "10.92.97.206"
      port: "162"
      version: "2"
      notification_type: "traps"
      state: "present"
      ip: "{{ imc_ip }}"
      username: "{{ imc_username }}"
      password: "{{ imc_password }}"`

Do you have any advice?

PS: the syslog, syslog_remote and snmp scripts working fine.

Thanks!

Enhancement -> IMC firmware upgrade management

Can someone look into developing CIMC firmware upgrade role/playbook? REST API or REDFISH API won't upgrade all of the modules and Cisco Intersight doesn't support Cisco appliances like APICs and Nexus Dashboard. Some Python scripts have been developed here but it would be preferred in Ansible.

thank you

Need module for updating bios settings

sanitized standalone example code:

from imcsdk.imchandle import ImcHandle
h = ImcHandle(ip, user, pass)
h.login()

flags_to_enable = {
  'sys/rack-unit-1/bios/bios-settings/Intel-Virtualization-Technology':
     ['vp_intel_virtualization_technology'],
  'sys/rack-unit-1/bios/bios-settings/Intel-VT-for-directed-IO':
    ['vp_intel_vtd_pass_through_dma_support',
     'vp_intel_vtd_coherency_support',
     'vp_intel_vt_for_directed_io',
     'vp_intel_vtd_interrupt_remapping',
     'vp_intel_vtdats_support'],
}

for dn, flags in flags_to_enable.iteritems():
  managed_object = h.query_dn(dn)
  for flag in flags:
    setattr(managed_object, flag, "enabled")
  h.set_mo(managed_object)
  managed_object = h.query_dn(dn)

h.logout()

Not able to configure ipmi

Run the below task -

tasks:
    - name: enable ipmi case1
      cisco_imc_ipmi:
        state: present
        priv: user
        ip: '{{ imc_ip }}'
        username: '{{ imc_username }}'
        password: '{{ imc_password }}'

Output -

ansible-playbook -i inventory create_config/test_create_ipmi.yml 

PLAY [imc] **********************************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************
ok: [classic_imc16]

TASK [enable ipmi case1] ********************************************************************************************************************************
ok: [classic_imc16]

PLAY RECAP **********************************************************************************************************************************************
classic_imc16              : ok=2    changed=0    unreachable=0    failed=0 

Nothing changes on the CIMC GUI, tried with priv values user, admin and read-only.
In cisco_imc_ipmi.py module, the values of server_id are mentioned as read-only, user and admin. It should be default value 1.

Setting SoL details throws error

IMC version: 3.0(3a) and 2.0(13e)

When trying to set the serial over lan details using cisco_imc_sol module, the playbook throws error.

Executed the below snippet -

- name: sol setup case1
      cisco_imc_sol:
        speed: 57600
        comport: com0
        ssh_port: 2000
        state: present
        ip: "{{ imc_ip }}"
        username: "{{ imc_username }}"
        password: "{{ imc_password }}"

Observed below error -

fatal: [imc17]: FAILED! => {"changed": false, "failed": true, "msg": "Unsupported parameters for (cisco_imc_sol) module: comport. Supported parameters include: com_port,ip,password,port,proxy,secure,server,server_id,speed,ssh_port,state,username"}

Also observed in cisco_imc_sol.py that parameter value of server_id is mentioned as read-only, admin, user instead of 1.

Feature request: Configure VIC cards

Are there plans to enable the configuration of a VIC card?

I'd like to be able to configure multiple vNICs on 1 or more VIC cards in a server.

Not able to set password expiration details

IMC version: 3.0(3a) and 2.0(13e)

When trying to set the password expiration details using cisco_imc_password_policy, nothing changes in the cimc gui and the playbook throws warning message -

Executed the below snippet -

- name: enable strong password and set password expiration details
      cisco_imc_password_policy:
        strong_password: enabled
        password_expiry_duration: 1
        password_history: 1
        password_notification_period: 1
        password_grace_period: 1
        ip: "{{ imc_ip }}"
        username: "{{ imc_username }}"
        password: "{{ imc_password }}"

Observed below warning -

[WARNING]: Module did not set no_log for password_expiry_duration
[WARNING]: Module did not set no_log for password_notification_period
[WARNING]: Module did not set no_log for password_grace_period
[WARNING]: Module did not set no_log for password

cisco_imc_virtual_drive write_policy docs incorrect

write_policy:

  | description: This can be one of the following,
  | "Write Through" Data is written through the cache and to the physical drives. Performance is improved, because subsequent reads of that data can be satisfied from the cache.
***incorrect docs  | "Write Back Good BBU" Data is stored in the cache, and is only written to the physical drives when space in the cache is needed. Virtual drives requesting this policy fall back to Write Through caching when the BBU cannot guarantee the safety of the cache in the event of a power failure.
***incorrect docs  | "Write Back Bad BBU" “Always Write Back” With this policy, write caching remains Write Back even if the battery backup unit is defective or discharged.
  | choices: ["Always Write Back", "Write Back Good BBU", "Write Through", "always-write-back", "write-back-good-bbu", "write-through"]
  | default: "Write Through"
  | required: false

Could not find imported module support code for cisco_imc_ntp. Looked for either ImcConnection.py or cisco_imc.py

Followed the install instructions... getting the following error:

PLAY [imc] *****************************************************************************************************************************************************************************************************

TASK [admin : enable ntp] **************************************************************************************************************************************************************************************
fatal: [C220-WMP243700Q8]: FAILED! => {"msg": "Could not find imported module support code for cisco_imc_ntp.  Looked for either ImcConnection.py or cisco_imc.py"}

PLAY RECAP *****************************************************************************************************************************************************************************************************
C220-WMP243700Q8           : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.