mirror of
				https://github.com/saltstack-formulas/sysctl-formula.git
				synced 2025-10-31 08:01:28 +01:00 
			
		
		
		
	Merge pull request #10 from enver/master
Added support to specify params as dictionary (as a params2)
This commit is contained in:
		
						commit
						97e305dc97
					
				| @ -11,3 +11,10 @@ sysctl: | ||||
|       -  | ||||
|         name: vm.swappiness | ||||
|         value: 20 | ||||
|     # Setting params2 excludes all params values | ||||
|     params2: | ||||
|       fs.file-max: | ||||
|         value: 100000 | ||||
|         config: fs.conf | ||||
|       vm.swappiness: | ||||
|         value: 20 | ||||
| @ -2,16 +2,34 @@ | ||||
| # vim: ft=sls | ||||
| 
 | ||||
| {## import settings from map.jinja ##} | ||||
| {% from "sysctl/map.jinja" import sysctl_settings with context %} | ||||
| {%- from "sysctl/map.jinja" import sysctl_settings with context -%} | ||||
| 
 | ||||
| {% for param in  sysctl_settings.get('params', {}) %} | ||||
|   {% if param is mapping %} | ||||
| {%- if sysctl_settings.params2 is defined -%} | ||||
| 
 | ||||
|   {%- for param_name, param in sysctl_settings.get('params2', {}).items() -%} | ||||
|     {%- if param is mapping %} | ||||
| sysctl-present-{{ param_name }}: | ||||
|   sysctl.present: | ||||
|     - name: {{ param_name }} | ||||
|     - value: {{ param.value }} | ||||
|       {%- if param.config is defined %} | ||||
|     - config: {{ sysctl_settings.config.location }}/{{ param.config }} | ||||
|       {% endif -%} | ||||
|     {% endif -%} | ||||
|   {% endfor %} | ||||
| 
 | ||||
| {% else %} | ||||
| 
 | ||||
|   {%- for param in  sysctl_settings.get('params', {}) -%} | ||||
|     {%- if param is mapping %} | ||||
| sysctl-present-{{ param.name }}: | ||||
|   sysctl.present: | ||||
|     - name: {{ param.name }} | ||||
|     - value: {{ param.value }} | ||||
|     {% if param.config is defined %} | ||||
|       {%- if param.config is defined %} | ||||
|     - config: {{ sysctl_settings.config.location }}/{{ param.config }} | ||||
|     {% endif %} | ||||
|   {% endif %} | ||||
| {% endfor %} | ||||
|       {% endif -%} | ||||
|     {% endif -%} | ||||
|   {% endfor %} | ||||
| 
 | ||||
| {%- endif -%} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user