Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • v2.28.0
  • v2.27.0
  • v2.25.1
  • v2.24.3
  • v2.26.0
  • v2.24.2
  • v2.25.0
  • v2.24.1
  • v2.22.2
  • v2.23.3
  • v2.24.0
  • v2.23.2
  • v2.23.1
  • v2.23.0
  • v2.22.1
  • v2.22.0
  • v2.21.0
  • v2.20.0
  • v2.19.1
  • v2.18.2
21 results

docs

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Thomas Woerner authored
    This class is an extended version of the Ansible Module that provides
    IPA specific methods to simplify module generation.
    
    Simple example:
    
        from ansible.module_utils.ansible_freeipa_module import \
            IPAAnsibleModule
    
        def main():
            ansible_module = IPAAnsibleModule(
                argument_spec=dict(
                      name=dict(type="str", aliases=["cn"], default=None),
                      state=dict(type="str", default="present",
                                 choices=["present", "absent"]),
                ),
            )
    
            # Get parameters
            name = ansible_module.params_get("name")
            state = ansible_module.params_get("state")
    
            # Connect to IPA API
            with ansible_module.ipa_connect():
    
                # Execute command
                if state == "present":
                    ansible_module.ipa_command(["command_add", name, {}])
                else:
                    ansible_module.ipa_command(["command_del", name, {}])
    
            # Done
    
            ansible_module.exit_json(changed=True)
    
        if __name__ == "__main__":
            main()
    d01c42d7
    History
    Name Last commit Last update
    ..