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

Support for sending OS command to LPAR/partition #938

Open
andy-maier opened this issue Mar 17, 2024 · 0 comments
Open

Support for sending OS command to LPAR/partition #938

andy-maier opened this issue Mar 17, 2024 · 0 comments
Assignees
Milestone

Comments

@andy-maier
Copy link
Member

andy-maier commented Mar 17, 2024

Add support for sending an OS command to the OS running in an LPAR or partition, using the existing zhmcclient Lpar.send_os_command() and Partition.send_os_command() methods.

That support will not be idempotent.

This had been requested earlier in issue #565.

Here is a way to do that today, using the Ansible uri module to issue the HMC operation directly, and a session ID from the ibm_zhmc.zhmc_session module.

- name: Create an HMC session
  zhmc_session:
    hmc_host: "{{ my_hmc_host }}"
    hmc_auth:
      userid: "{{ my_hmc_userid }}"
      password: "{{ my_hmc_password }}"
      verify: false
    action: create
  register: session
  no_log: true

- name: "Send OS command {{ my_cmd }}"
  ansible.builtin.uri:
    url: "{{ session.hmc_host }}:6794{{ lpar_uri }}/operations/send-os-cmd"
    method: POST
    body:
      is-priority: false
      operating-system-command-text: "{{ my_cmd }}"
    headers:
      x-api-session: "{{ session.hmc_auth.session_id }}"
    validate_certs: no
    status_code: 204

- name: Delete the HMC session
  zhmc_session:
    hmc_host: "{{ session.hmc_host }}"  
    hmc_auth: "{{ session.hmc_auth }}"
    action: delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant