예제 #1
0
    def del_key(self, user, key_path, proxy):
        """
        push the ssh authorized key to target.
        """

        module_args = 'user="******" key="{{ lookup("file", "%s") }}" state="absent"' % (
            user, key_path)
        data = {
            'mod_name': 'authorized_key',
            'resource': self.resource,
            'hosts': self.host_list,
            'mod_args': module_args,
            'role_name': user
        }
        data = json.dumps(data)
        api = APIRequest('{0}/v1.0/module'.format(proxy.url), proxy.username,
                         CRYPTOR(proxy.password))
        result, code = api.req_post(data)
        return result