ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
62.69k stars 23.86k forks source link

.MSI extension fails win_package #34465

Closed derekslenk closed 6 years ago

derekslenk commented 6 years ago

https://github.com/ansible/ansible/blob/9dc9313c65ceafd4f840ccb67cbe50db42db47a8/lib/ansible/modules/windows/win_package.ps1#L176

Don't get hung up on the references to SQLDOM.MSI. Just the installer I had that downloaded with an all uppercase file extension.

ISSUE TYPE
COMPONENT NAME

win_package

ANSIBLE VERSION
ansible 2.4.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/username/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, May  3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]
CONFIGURATION

ACCELERATE_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 5.0 ACCELERATE_DAEMON_TIMEOUT(/etc/ansible/ansible.cfg) = 30 ACCELERATE_PORT(/etc/ansible/ansible.cfg) = 5099 ACCELERATE_TIMEOUT(/etc/ansible/ansible.cfg) = 30 CACHE_PLUGIN(/etc/ansible/ansible.cfg) = memory DEFAULT_ACTION_PLUGIN_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/ansible_plugins/action_plugins'] DEFAULT_CALLBACK_PLUGIN_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/ansible_plugins/callback_plugins'] DEFAULT_CONNECTION_PLUGIN_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/ansible_plugins/connection_plugins'] DEFAULT_FILTER_PLUGIN_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/ansible_plugins/filter_plugins'] DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 5 DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = implicit DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = [u'/etc/ansible/hosts'] DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /var/log/ansible.log DEFAULT_LOOKUP_PLUGIN_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/ansible_plugins/lookup_plugins'] DEFAULT_MANAGED_STR(/etc/ansible/ansible.cfg) = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host} DEFAULT_MODULE_LANG(/etc/ansible/ansible.cfg) = C DEFAULT_POLL_INTERVAL(/etc/ansible/ansible.cfg) = 15 DEFAULT_REMOTE_TMP(/etc/ansible/ansible.cfg) = /tmp/ansible DEFAULT_SCP_IF_SSH(/etc/ansible/ansible.cfg) = True DEFAULT_SUDO_EXE(/etc/ansible/ansible.cfg) = sudo DEFAULT_SUDO_USER(/etc/ansible/ansible.cfg) = root DEFAULT_TIMEOUT(/etc/ansible/ansible.cfg) = 10 DEFAULT_TRANSPORT(/etc/ansible/ansible.cfg) = smart DEFAULT_VARS_PLUGIN_PATH(/etc/ansible/ansible.cfg) = [u'/usr/share/ansible_plugins/vars_plugins'] HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False

OS / ENVIRONMENT

RHEL 7

SUMMARY

When using win_package to try and install a file ending with the extension .MSI, the installer fails saying "failed to start executable C:\\installs\filename.MSI: The specified executable is not a valid application for this OS platform."

The same file installs fine when renamed with .msi

STEPS TO REPRODUCE
- name: Install all the msi packages
  win_package:
    path: "{{ msi_install_location }}\\{{ item.filename }}"
    state: present
    arguments: "{{ item.args }}"
    Product_ID: "{{ item.product_id }}"
  notify:
    - reboot instance
  with_items: "{{ packages }}"

packages:
  - { filename: "filename.MSI", args: "/quiet", product_id: "{0E8670B8-3965-4930-ADA6-570348B67153}"}
EXPECTED RESULTS
changed: [172.29.39.92] => (item={u'args': u'/quiet', u'product_id': u'{0E8670B8-3965-4930-ADA6-570348B67153}', u'filename': u'SQLDOM.MSI'})

--

ACTUAL RESULTS
Using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_package.ps1
EXEC (via pipeline wrapper)
failed: [172.29.39.58] (item={u'args': u'/quiet', u'product_id': u'{0E8670B8-3965-4930-ADA6-570348B67153}', u'filename': u'SQLDOM.MSI'}) => {
  "changed": false, 
  "item": {
      "args": "/quiet", 
      "filename": "SQLDOM.MSI", 
      "product_id": "{0E8670B8-3965-4930-ADA6-570348B67153}"
  }, 
  "msg": "failed to start executable C:\\\\installs\\SQLDOM.MSI: The specified executable is not a valid application for this OS platform.", 
  "reboot_required": false, 
  "restart_required": false
}
ansibot commented 6 years ago

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibot commented 6 years ago

cc @dagwieers @jborean93 @jhawkesworth @nitzmahone @trondhindenes click here for bot help

jborean93 commented 6 years ago

Thanks @derekslenk for letting us know about this. I've raised a PR here https://github.com/ansible/ansible/pull/34476 and will backport to 2.4 when the tests are complete. Feel free to test it out if you can.

Otherwise to get you going today I would either

One thing to note, win_package will add the /quiet argument for MSI's automatically so you don't need to specify any arguments in your case.