SUSE / rookcheck

Apache License 2.0
4 stars 11 forks source link

Add repositories override #199

Closed brunoleon closed 4 years ago

brunoleon commented 4 years ago

When using a local mirror of repos and passing them as ROOKCHECK_ANSIBLE_EXTRA_VARS, the default repos are still configured though not used because of priorities. This slows down deployment because of the refresh, and is not always necessary. This PR add an options extra_repos_only that can be set to true so that ansible only use extra repos.

jhesketh commented 4 years ago

This is starting to get a bit convoluted. Wouldn't it be better to use ROOKCHECK_ANSIBLE_EXTRA_VARS to set "repositories" (maybe renaming that var to something more explicit and moving it into a file)?

brunoleon commented 4 years ago

The thing is ROOKCHECK_ANSIBLE_EXTRA_VARS can be used to pass anything to ansible, not only repositories. I also thought about placing this into a file, but overall I'm not sure it is really easier.

For example I just pass: export ROOKCHECK_ANSIBLE_EXTRA_VARS='{"extra_repos_only": "true", "extra_repos":{"basesystem_pool": "http://192.168.122.1/Products/SLE-Module-Basesystem/15-SP2/x86_64/product/", "basesystem_updates": "http://192.168.122.1/Updates/SLE-Module-Basesystem/15-SP2/x86_64/update/", "containers_pool": "http://192.168.122.1/Products/SLE-Module-Containers/15-SP2/x86_64/product/", "containers_updates": "http://192.168.122.1/Updates/SLE-Module-Containers/15-SP2/x86_64/update/", "serverapps_pool": "http://192.168.122.1/Products/SLE-Module-Server-Applications/15-SP2/x86_64/product/", "serverapps_updates": "http://192.168.122.1/Updates/SLE-Module-Server-Applications/15-SP2/x86_64/update/", "sle_server_pool": "http://192.168.122.1/Products/SLE-Product-SLES/15-SP2/x86_64/product/", "sle_server_updates": "http://192.168.122.1/Updates/SLE-Product-SLES/15-SP2/x86_64/update/", "caasp": "http://192.168.122.1/Products/SUSE-CAASP/4.5/x86_64/product/", "caasp_updates": "http://192.168.122.1/Updates/SUSE-CAASP/4.5/x86_64/update/", "public_cloud": "http://192.168.122.1/Products/SLE-Module-Public-Cloud/15-SP2/x86_64/product/"}}'

And this is working fine. . The other option is to have all repos within a yaml like config, and provide a way to override somehow that file

jhesketh commented 4 years ago

Right, I meant moving the default repos into roles/caasp/defaults/main.yaml and then using ROOKCHECK_ANSIBLE_EXTRA_VARS to overwrite the defaults. Thus we don't need an extra option for only using the extra_repos. In fact, we could possibly drop the extra repos, but then to add any more repos you still have to list the defaults.

brunoleon commented 4 years ago

I updated the PR so that we can override repos directly now.