wip
This commit is contained in:
		
							parent
							
								
									f2e9768e65
								
							
						
					
					
						commit
						181d187baf
					
				
					 5 changed files with 40 additions and 21 deletions
				
			
		
							
								
								
									
										17
									
								
								bundles/bind/files/db
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								bundles/bind/files/db
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					$TTL 600
 | 
				
			||||||
 | 
					@   IN  SOA     ns.sublimity.de. admin.sublimity.de. (
 | 
				
			||||||
 | 
					        2020080302  ;Serial
 | 
				
			||||||
 | 
					        1200        ;Refresh
 | 
				
			||||||
 | 
					        600         ;Retry
 | 
				
			||||||
 | 
					        1209600     ;Expire
 | 
				
			||||||
 | 
					        600         ;Negative response caching TTL
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					% for record in sorted(records, key=lambda r: (r['name'], r['type'], r['value'])):
 | 
				
			||||||
 | 
					  % for part in (record['value'][i:i+256] for i in range(0, len(record['value']), 255)):
 | 
				
			||||||
 | 
					${record['name'].ljust(column_width('name', records))} \
 | 
				
			||||||
 | 
					IN \
 | 
				
			||||||
 | 
					${record['type'].ljust(column_width('type', records))} \
 | 
				
			||||||
 | 
					"${part}"
 | 
				
			||||||
 | 
					  % endfor
 | 
				
			||||||
 | 
					% endfor
 | 
				
			||||||
							
								
								
									
										2
									
								
								bundles/bind/files/defaults
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								bundles/bind/files/defaults
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					RESOLVCONF=no
 | 
				
			||||||
 | 
					OPTIONS="-u bind"
 | 
				
			||||||
| 
						 | 
					@ -1,12 +0,0 @@
 | 
				
			||||||
$TTL 600
 | 
					 | 
				
			||||||
@   IN  SOA     ns.sublimity.de. admin.sublimity.de. (
 | 
					 | 
				
			||||||
        2020080302  ;Serial
 | 
					 | 
				
			||||||
        1200        ;Refresh
 | 
					 | 
				
			||||||
        600         ;Retry
 | 
					 | 
				
			||||||
        1209600     ;Expire
 | 
					 | 
				
			||||||
        600         ;Negative response caching TTL
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
% for record in records:
 | 
					 | 
				
			||||||
${record[0].ljust(max_name)} IN ${record[1].ljust(max_type)} ${record[2]}
 | 
					 | 
				
			||||||
% endfor
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,20 @@
 | 
				
			||||||
# for zone, records in node.metadata.get('bind/zones').items():
 | 
					directories['/var/lib/bind'] = {
 | 
				
			||||||
#     files[f'/var/lib/bind/{zone}'] = {
 | 
					    'purge': True,
 | 
				
			||||||
#         'source': 'zonefile',
 | 
					}
 | 
				
			||||||
#         'content_type': 'mako',
 | 
					
 | 
				
			||||||
#         'context': {
 | 
					files['/etc/default/bind9'] = {
 | 
				
			||||||
#             'records': records,
 | 
					    'source': 'defaults',
 | 
				
			||||||
#         }
 | 
					}
 | 
				
			||||||
#     }
 | 
					
 | 
				
			||||||
 | 
					def column_width(column, table):
 | 
				
			||||||
 | 
					    return max(map(lambda row: len(row[column]), table)) if table else 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for zone, records in node.metadata.get('bind/zones').items():
 | 
				
			||||||
 | 
					    files[f'/var/lib/bind/db.{zone}'] = {
 | 
				
			||||||
 | 
					        'source': 'db',
 | 
				
			||||||
 | 
					        'content_type': 'mako',
 | 
				
			||||||
 | 
					        'context': {
 | 
				
			||||||
 | 
					            'records': records,
 | 
				
			||||||
 | 
					            'column_width': column_width,
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@ def collect_records(metadata):
 | 
				
			||||||
                    zones\
 | 
					                    zones\
 | 
				
			||||||
                        .setdefault(zone, [])\
 | 
					                        .setdefault(zone, [])\
 | 
				
			||||||
                        .append(
 | 
					                        .append(
 | 
				
			||||||
                            (name, type, value)
 | 
					                            {'name': name, 'type': type, 'value': value}
 | 
				
			||||||
                        )
 | 
					                        )
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue