SaltStack: Set Proxy Variables Before pkg.installed
Use require for a normal sequential run, and choose deliberately whether the environment lasts in the current subprocess or main minion.
package_proxy_environment:
environ.setenv:
- name: package_proxy_environment
- value:
http_proxy: http://proxy.example:8080
https_proxy: http://proxy.example:8080
network_packages:
pkg.installed:
- pkgs:
- rsync
- lftp
- require:
- environ: package_proxy_environmentThe value mapping supplies actual proxy variable names. For public package sources where public proxies are permitted, the HTTP proxy list supplies candidates for these HTTP proxy URLs. require waits for successful completion of the environment state before the package state; nearby unconnected blocks do not express that dependency.
By default, environ.setenv affects the current Salt subprocess. update_minion=True additionally changes the main minion process, giving the values a broader lifetime. Neither sets an operating-system-wide proxy.
This applies when the selected package provider honors those environment inputs. A provider using another config file or a separate service needs that consumer configured instead. A Salt master's proxy is not automatically the minion's route.