def private_key_managed(name, bits=2048, passphrase=None, cipher='aes_128_cbc', new=False, verbose=True, **kwargs):
 (file_args, kwargs) = _get_file_args(name, **kwargs)
 new_key = False
 if _check_private_key(name, bits, passphrase, new):
  file_args['contents'] = __salt__['x509.get_pem_entry'](name, pem_type='RSA PRIVATE KEY')
 else:
  new_key = True
  file_args['contents'] = __salt__['x509.create_private_key'](text=True, bits=bits, passphrase=passphrase, cipher=cipher, verbose=verbose)
 ret = __states__['file.managed'](**file_args)
 if (ret['changes'] and new_key):
  ret['changes'] = 'New private key generated'
 return ret

def private_key_managed ( name , bits = 2048 , passphrase = None , cipher = 'aes_128_cbc' , new = False , verbose = True , ** kwargs ) : ( file_args , kwargs ) = _get_file_args ( name , ** kwargs ) new_key = False if _check_private_key ( name , bits , passphrase , new ) : file_args [ 'contents' ] = __salt__ [ 'x509.get_pem_entry' ] ( name , pem_type = 'RSA PRIVATE KEY' ) else : new_key = True file_args [ 'contents' ] = __salt__ [ 'x509.create_private_key' ] ( text = True , bits = bits , passphrase = passphrase , cipher = cipher , verbose = verbose ) ret = __states__ [ 'file.managed' ] ( ** file_args ) if ( ret [ 'changes' ] and new_key ) : ret [ 'changes' ] = 'New private key generated' return ret
manage a private keys existence .