ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
198 stars 153 forks source link

feat(win_psmodule): add argument to set force parameter #508

Closed gotit96 closed 1 year ago

gotit96 commented 1 year ago
SUMMARY

This proposed change, add an argument to win_psmodule to make Install-Module -Force parameter optionnal.

fix #286

ISSUE TYPE
COMPONENT NAME

win_psmodule

ADDITIONAL INFORMATION

Using Force parameter when installing module, implies the reinstallation of all module dependency using lastest version. Even if dependency are already filled. This increases installation time and removes the ability to manage module version at the playbook level.

Sample run with community.windows 1.12.0

TASK [PrintOut installed modules]
ok: [server-03] => (item=SqlServer) => {
    "msg": "version: 21.1.18256"
}
ok: [server-03] => (item=SqlServerDsc) => {
    "msg": "version: 12.5.0.0"
}

TASK [Install module DbData with allow_clobber]
changed: [server-03]

TASK [PrintOut installed modules]
ok: [server-03] => (item=DbData) => {
    "msg": "version: 2.2.2"
}
ok: [server-03] => (item=SqlServer) => {
    "msg": "version: 22.0.59"
}
ok: [server-03] => (item=SqlServer) => {
    "msg": "version: 21.1.18256"
}
ok: [server-03] => (item=SqlServerDsc) => {
    "msg": "version: 12.5.0.0"
}

Install module DbData with allow allow_clobber ------------------------------------------------------- 87.75s

Sample run with proposed change

TASK [PrintOut installed modules]
ok: [server-03] => (item=SqlServer) => {
    "msg": "version: 21.1.18256"
}
ok: [server-03] => (item=SqlServerDsc) => {
    "msg": "version: 12.5.0.0"
}

TASK [Install module DbData with allow_clobber]
changed: [server-03]

TASK [PrintOut installed modules]
ok: [server-03] => (item=DbData) => {
    "msg": "version: 2.2.2"
}
ok: [server-03] => (item=SqlServer) => {
    "msg": "version: 21.1.18256"
}
ok: [server-03] => (item=SqlServerDsc) => {
    "msg": "version: 12.5.0.0"
}

Install module DbData with allow allow_clobber ------------------------------------------------------- 16.54s
jborean93 commented 1 year ago

Thanks for adding this.