mirror of
				https://github.com/saltstack-formulas/users-formula.git
				synced 2025-11-04 10:23:38 +01:00 
			
		
		
		
	Merge pull request #68 from roedie/add-ssh-config-management
Add ~/.ssh/config management
This commit is contained in:
		
						commit
						69a4d981f3
					
				@ -44,6 +44,17 @@ users:
 | 
			
		||||
    # than inline in pillar, this works.
 | 
			
		||||
    ssh_auth_sources:
 | 
			
		||||
      - salt://keys/buser.id_rsa.pub
 | 
			
		||||
    # Manage the ~/.ssh/config file
 | 
			
		||||
    ssh_config:
 | 
			
		||||
      all:
 | 
			
		||||
        hostname: "*"
 | 
			
		||||
        options:
 | 
			
		||||
          - "StrictHostKeyChecking no"
 | 
			
		||||
          - "UserKnownHostsFile=/dev/null"
 | 
			
		||||
      importanthost:
 | 
			
		||||
        hostname: "needcheck.example.com"
 | 
			
		||||
        options:
 | 
			
		||||
          - "StrictHostKeyChecking yes"
 | 
			
		||||
 | 
			
		||||
    google_auth:
 | 
			
		||||
      ssh: |
 | 
			
		||||
 | 
			
		||||
@ -208,6 +208,25 @@ users_ssh_auth_delete_{{ name }}_{{ loop.index0 }}:
 | 
			
		||||
{% endfor %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% if 'ssh_config' in user %}
 | 
			
		||||
users_ssh_config_{{ name }}:
 | 
			
		||||
  file.managed:
 | 
			
		||||
    - name: {{ home }}/.ssh/config
 | 
			
		||||
    - user: {{ name }}
 | 
			
		||||
    - group: {{ user_group }}
 | 
			
		||||
    - mode: 640
 | 
			
		||||
    - contents: |
 | 
			
		||||
        # Managed by Saltstack
 | 
			
		||||
        # Do Not Edit
 | 
			
		||||
        {% for label, setting in user.ssh_config.items() %}
 | 
			
		||||
        # {{ label }}
 | 
			
		||||
        Host {{ setting.get('hostname') }}
 | 
			
		||||
          {%- for opts in setting.get('options') %}
 | 
			
		||||
          {{ opts }}
 | 
			
		||||
          {%- endfor %}
 | 
			
		||||
        {% endfor -%}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% if 'sudouser' in user and user['sudouser'] %}
 | 
			
		||||
 | 
			
		||||
users_sudoer-{{ name }}:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user