We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
ipa_service: Add skip_host_check option
### Summary

Module ipa_service has missing functionality `skip_host_check` to create service without checking if host exist or not.

### Issue Type

Feature Idea

### Component Name

ipa_service.py

### Additional Information

```yaml (paste below)
      ipa_service:
        name: "http/webserver.example.com@EXAMPLE.COM"
        state: present
        force: True
        skip_host_check: True
        ipa_host: "{{ freeipa_client_ipa_server }}"
        ipa_user: "{{ freeipa_client_ipa_user }}"
        ipa_pass: "{{ freeipa_client_ipa_password }}"
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `plugins/modules/identity/ipa/ipa_service.py`
Content:
```
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # Copyright: (c) 2018, Ansible Project
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5 
6 from __future__ import absolute_import, division, print_function
7 __metaclass__ = type
8 
9 DOCUMENTATION = r'''
10 ---
11 module: ipa_service
12 author: Cédric Parent (@cprh)
13 short_description: Manage FreeIPA service
14 description:
15 - Add and delete an IPA service using IPA API.
16 options:
17   krbcanonicalname:
18     description:
19     - Principal of the service.
20     - Can not be changed as it is the unique identifier.
21     required: true
22     aliases: ["name"]
23     type: str
24   hosts:
25     description:
26     - Defines the list of 'ManagedBy' hosts.
27     required: false
28     type: list
29     elements: str
30   force:
31     description:
32     - Force principal name even if host is not in DNS.
33     required: false
34     type: bool
35   state:
36     description: State to ensure.
37     required: false
38     default: present
39     choices: ["absent", "present"]
40     type: str
41 extends_documentation_fragment:
42 - community.general.ipa.documentation
43 
44 '''
45 
46 EXAMPLES = r'''
47 - name: Ensure service is present
48   community.general.ipa_service:
49     name: http/host01.example.com
50     state: present
51     ipa_host: ipa.example.com
52     ipa_user: admin
53     ipa_pass: topsecret
54 
55 - name: Ensure service is absent
56   community.general.ipa_service:
57     name: http/host01.example.com
58     state: absent
59     ipa_host: ipa.example.com
60     ipa_user: admin
61     ipa_pass: topsecret
62 
63 - name: Changing Managing hosts list
64   community.general.ipa_service:
65     name: http/host01.example.com
66     hosts:
67        - host01.example.com
68        - host02.example.com
69     ipa_host: ipa.example.com
70     ipa_user: admin
71     ipa_pass: topsecret
72 '''
73 
74 RETURN = r'''
75 service:
76   description: Service as returned by IPA API.
77   returned: always
78   type: dict
79 '''
80 
81 import traceback
82 
83 from ansible.module_utils.basic import AnsibleModule
84 from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
85 from ansible.module_utils.common.text.converters import to_native
86 
87 
88 class ServiceIPAClient(IPAClient):
89     def __init__(self, module, host, port, protocol):
90         super(ServiceIPAClient, self).__init__(module, host, port, protocol)
91 
92     def service_find(self, name):
93         return self._post_json(method='service_find', name=None, item={'all': True, 'krbcanonicalname': name})
94 
95     def service_add(self, name, service):
96         return self._post_json(method='service_add', name=name, item=service)
97 
98     def service_mod(self, name, service):
99         return self._post_json(method='service_mod', name=name, item=service)
100 
101     def service_del(self, name):
102         return self._post_json(method='service_del', name=name)
103 
104     def service_disable(self, name):
105         return self._post_json(method='service_disable', name=name)
106 
107     def service_add_host(self, name, item):
108         return self._post_json(method='service_add_host', name=name, item={'host': item})
109 
110     def service_remove_host(self, name, item):
111         return self._post_json(method='service_remove_host', name=name, item={'host': item})
112 
113 
114 def get_service_dict(force=None, krbcanonicalname=None):
115     data = {}
116     if force is not None:
117         data['force'] = force
118     if krbcanonicalname is not None:
119         data['krbcanonicalname'] = krbcanonicalname
120     return data
121 
122 
123 def get_service_diff(client, ipa_host, module_service):
124     non_updateable_keys = ['force', 'krbcanonicalname']
125     for key in non_updateable_keys:
126         if key in module_service:
127             del module_service[key]
128 
129     return client.get_diff(ipa_data=ipa_host, module_data=module_service)
130 
131 
132 def ensure(module, client):
133     name = module.params['krbcanonicalname']
134     state = module.params['state']
135     hosts = module.params['hosts']
136 
137     ipa_service = client.service_find(name=name)
138     module_service = get_service_dict(force=module.params['force'])
139     changed = False
140     if state in ['present', 'enabled', 'disabled']:
141         if not ipa_service:
142             changed = True
143             if not module.check_mode:
144                 client.service_add(name=name, service=module_service)
145         else:
146             diff = get_service_diff(client, ipa_service, module_service)
147             if len(diff) > 0:
148                 changed = True
149                 if not module.check_mode:
150                     data = {}
151                     for key in diff:
152                         data[key] = module_service.get(key)
153                     client.service_mod(name=name, service=data)
154         if hosts is not None:
155             if 'managedby_host' in ipa_service:
156                 for host in ipa_service['managedby_host']:
157                     if host not in hosts:
158                         if not module.check_mode:
159                             client.service_remove_host(name=name, item=host)
160                         changed = True
161                 for host in hosts:
162                     if host not in ipa_service['managedby_host']:
163                         if not module.check_mode:
164                             client.service_add_host(name=name, item=host)
165                         changed = True
166             else:
167                 for host in hosts:
168                     if not module.check_mode:
169                         client.service_add_host(name=name, item=host)
170                     changed = True
171 
172     else:
173         if ipa_service:
174             changed = True
175             if not module.check_mode:
176                 client.service_del(name=name)
177 
178     return changed, client.service_find(name=name)
179 
180 
181 def main():
182     argument_spec = ipa_argument_spec()
183     argument_spec.update(
184         krbcanonicalname=dict(type='str', required=True, aliases=['name']),
185         force=dict(type='bool', required=False),
186         hosts=dict(type='list', required=False, elements='str'),
187         state=dict(type='str', required=False, default='present',
188                    choices=['present', 'absent']))
189 
190     module = AnsibleModule(argument_spec=argument_spec,
191                            supports_check_mode=True)
192 
193     client = ServiceIPAClient(module=module,
194                               host=module.params['ipa_host'],
195                               port=module.params['ipa_port'],
196                               protocol=module.params['ipa_prot'])
197 
198     try:
199         client.login(username=module.params['ipa_user'],
200                      password=module.params['ipa_pass'])
201         changed, host = ensure(module, client)
202         module.exit_json(changed=changed, host=host)
203     except Exception as e:
204         module.fail_json(msg=to_native(e), exception=traceback.format_exc())
205 
206 
207 if __name__ == '__main__':
208     main()
209
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/plugins/modules/identity/ipa/ipa_service.py b/plugins/modules/identity/ipa/ipa_service.py
--- a/plugins/modules/identity/ipa/ipa_service.py
+++ b/plugins/modules/identity/ipa/ipa_service.py
@@ -32,6 +32,14 @@
     - Force principal name even if host is not in DNS.
     required: false
     type: bool
+  skip_host_check:
+    description:
+    - Force service to be created even when host object does not exist to manage it.
+    - This is only used on creation, not for updating existing services.
+    required: false
+    type: bool
+    default: false
+    version_added: 4.7.0
   state:
     description: State to ensure.
     required: false
@@ -111,17 +119,19 @@
         return self._post_json(method='service_remove_host', name=name, item={'host': item})
 
 
-def get_service_dict(force=None, krbcanonicalname=None):
+def get_service_dict(force=None, krbcanonicalname=None, skip_host_check=None):
     data = {}
     if force is not None:
         data['force'] = force
     if krbcanonicalname is not None:
         data['krbcanonicalname'] = krbcanonicalname
+    if skip_host_check is not None:
+        data['skip_host_check'] = skip_host_check
     return data
 
 
 def get_service_diff(client, ipa_host, module_service):
-    non_updateable_keys = ['force', 'krbcanonicalname']
+    non_updateable_keys = ['force', 'krbcanonicalname', 'skip_host_check']
     for key in non_updateable_keys:
         if key in module_service:
             del module_service[key]
@@ -135,7 +145,7 @@
     hosts = module.params['hosts']
 
     ipa_service = client.service_find(name=name)
-    module_service = get_service_dict(force=module.params['force'])
+    module_service = get_service_dict(force=module.params['force'], skip_host_check=module.params['skip_host_check'])
     changed = False
     if state in ['present', 'enabled', 'disabled']:
         if not ipa_service:
@@ -183,6 +193,7 @@
     argument_spec.update(
         krbcanonicalname=dict(type='str', required=True, aliases=['name']),
         force=dict(type='bool', required=False),
+        skip_host_check=dict(type='bool', default=False, required=False),
         hosts=dict(type='list', required=False, elements='str'),
         state=dict(type='str', required=False, default='present',
                    choices=['present', 'absent']))

{"golden_diff": "diff --git a/plugins/modules/identity/ipa/ipa_service.py b/plugins/modules/identity/ipa/ipa_service.py\n--- a/plugins/modules/identity/ipa/ipa_service.py\n+++ b/plugins/modules/identity/ipa/ipa_service.py\n@@ -32,6 +32,14 @@\n     - Force principal name even if host is not in DNS.\n     required: false\n     type: bool\n+  skip_host_check:\n+    description:\n+    - Force service to be created even when host object does not exist to manage it.\n+    - This is only used on creation, not for updating existing services.\n+    required: false\n+    type: bool\n+    default: false\n+    version_added: 4.7.0\n   state:\n     description: State to ensure.\n     required: false\n@@ -111,17 +119,19 @@\n         return self._post_json(method='service_remove_host', name=name, item={'host': item})\n \n \n-def get_service_dict(force=None, krbcanonicalname=None):\n+def get_service_dict(force=None, krbcanonicalname=None, skip_host_check=None):\n     data = {}\n     if force is not None:\n         data['force'] = force\n     if krbcanonicalname is not None:\n         data['krbcanonicalname'] = krbcanonicalname\n+    if skip_host_check is not None:\n+        data['skip_host_check'] = skip_host_check\n     return data\n \n \n def get_service_diff(client, ipa_host, module_service):\n-    non_updateable_keys = ['force', 'krbcanonicalname']\n+    non_updateable_keys = ['force', 'krbcanonicalname', 'skip_host_check']\n     for key in non_updateable_keys:\n         if key in module_service:\n             del module_service[key]\n@@ -135,7 +145,7 @@\n     hosts = module.params['hosts']\n \n     ipa_service = client.service_find(name=name)\n-    module_service = get_service_dict(force=module.params['force'])\n+    module_service = get_service_dict(force=module.params['force'], skip_host_check=module.params['skip_host_check'])\n     changed = False\n     if state in ['present', 'enabled', 'disabled']:\n         if not ipa_service:\n@@ -183,6 +193,7 @@\n     argument_spec.update(\n         krbcanonicalname=dict(type='str', required=True, aliases=['name']),\n         force=dict(type='bool', required=False),\n+        skip_host_check=dict(type='bool', default=False, required=False),\n         hosts=dict(type='list', required=False, elements='str'),\n         state=dict(type='str', required=False, default='present',\n                    choices=['present', 'absent']))\n", "issue": "ipa_service: Add skip_host_check option\n### Summary\n\nModule ipa_service has missing functionality `skip_host_check` to create service without checking if host exist or not.\n\n### Issue Type\n\nFeature Idea\n\n### Component Name\n\nipa_service.py\n\n### Additional Information\n\n```yaml (paste below)\r\n      ipa_service:\r\n        name: \"http/webserver.example.com@EXAMPLE.COM\"\r\n        state: present\r\n        force: True\r\n        skip_host_check: True\r\n        ipa_host: \"{{ freeipa_client_ipa_server }}\"\r\n        ipa_user: \"{{ freeipa_client_ipa_user }}\"\r\n        ipa_pass: \"{{ freeipa_client_ipa_password }}\"\r\n```\r\n\n\n### Code of Conduct\n\n- [X] I agree to follow the Ansible Code of Conduct\n", "before_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n# Copyright: (c) 2018, Ansible Project\n# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)\n\nfrom __future__ import absolute_import, division, print_function\n__metaclass__ = type\n\nDOCUMENTATION = r'''\n---\nmodule: ipa_service\nauthor: C\u00e9dric Parent (@cprh)\nshort_description: Manage FreeIPA service\ndescription:\n- Add and delete an IPA service using IPA API.\noptions:\n  krbcanonicalname:\n    description:\n    - Principal of the service.\n    - Can not be changed as it is the unique identifier.\n    required: true\n    aliases: [\"name\"]\n    type: str\n  hosts:\n    description:\n    - Defines the list of 'ManagedBy' hosts.\n    required: false\n    type: list\n    elements: str\n  force:\n    description:\n    - Force principal name even if host is not in DNS.\n    required: false\n    type: bool\n  state:\n    description: State to ensure.\n    required: false\n    default: present\n    choices: [\"absent\", \"present\"]\n    type: str\nextends_documentation_fragment:\n- community.general.ipa.documentation\n\n'''\n\nEXAMPLES = r'''\n- name: Ensure service is present\n  community.general.ipa_service:\n    name: http/host01.example.com\n    state: present\n    ipa_host: ipa.example.com\n    ipa_user: admin\n    ipa_pass: topsecret\n\n- name: Ensure service is absent\n  community.general.ipa_service:\n    name: http/host01.example.com\n    state: absent\n    ipa_host: ipa.example.com\n    ipa_user: admin\n    ipa_pass: topsecret\n\n- name: Changing Managing hosts list\n  community.general.ipa_service:\n    name: http/host01.example.com\n    hosts:\n       - host01.example.com\n       - host02.example.com\n    ipa_host: ipa.example.com\n    ipa_user: admin\n    ipa_pass: topsecret\n'''\n\nRETURN = r'''\nservice:\n  description: Service as returned by IPA API.\n  returned: always\n  type: dict\n'''\n\nimport traceback\n\nfrom ansible.module_utils.basic import AnsibleModule\nfrom ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec\nfrom ansible.module_utils.common.text.converters import to_native\n\n\nclass ServiceIPAClient(IPAClient):\n    def __init__(self, module, host, port, protocol):\n        super(ServiceIPAClient, self).__init__(module, host, port, protocol)\n\n    def service_find(self, name):\n        return self._post_json(method='service_find', name=None, item={'all': True, 'krbcanonicalname': name})\n\n    def service_add(self, name, service):\n        return self._post_json(method='service_add', name=name, item=service)\n\n    def service_mod(self, name, service):\n        return self._post_json(method='service_mod', name=name, item=service)\n\n    def service_del(self, name):\n        return self._post_json(method='service_del', name=name)\n\n    def service_disable(self, name):\n        return self._post_json(method='service_disable', name=name)\n\n    def service_add_host(self, name, item):\n        return self._post_json(method='service_add_host', name=name, item={'host': item})\n\n    def service_remove_host(self, name, item):\n        return self._post_json(method='service_remove_host', name=name, item={'host': item})\n\n\ndef get_service_dict(force=None, krbcanonicalname=None):\n    data = {}\n    if force is not None:\n        data['force'] = force\n    if krbcanonicalname is not None:\n        data['krbcanonicalname'] = krbcanonicalname\n    return data\n\n\ndef get_service_diff(client, ipa_host, module_service):\n    non_updateable_keys = ['force', 'krbcanonicalname']\n    for key in non_updateable_keys:\n        if key in module_service:\n            del module_service[key]\n\n    return client.get_diff(ipa_data=ipa_host, module_data=module_service)\n\n\ndef ensure(module, client):\n    name = module.params['krbcanonicalname']\n    state = module.params['state']\n    hosts = module.params['hosts']\n\n    ipa_service = client.service_find(name=name)\n    module_service = get_service_dict(force=module.params['force'])\n    changed = False\n    if state in ['present', 'enabled', 'disabled']:\n        if not ipa_service:\n            changed = True\n            if not module.check_mode:\n                client.service_add(name=name, service=module_service)\n        else:\n            diff = get_service_diff(client, ipa_service, module_service)\n            if len(diff) > 0:\n                changed = True\n                if not module.check_mode:\n                    data = {}\n                    for key in diff:\n                        data[key] = module_service.get(key)\n                    client.service_mod(name=name, service=data)\n        if hosts is not None:\n            if 'managedby_host' in ipa_service:\n                for host in ipa_service['managedby_host']:\n                    if host not in hosts:\n                        if not module.check_mode:\n                            client.service_remove_host(name=name, item=host)\n                        changed = True\n                for host in hosts:\n                    if host not in ipa_service['managedby_host']:\n                        if not module.check_mode:\n                            client.service_add_host(name=name, item=host)\n                        changed = True\n            else:\n                for host in hosts:\n                    if not module.check_mode:\n                        client.service_add_host(name=name, item=host)\n                    changed = True\n\n    else:\n        if ipa_service:\n            changed = True\n            if not module.check_mode:\n                client.service_del(name=name)\n\n    return changed, client.service_find(name=name)\n\n\ndef main():\n    argument_spec = ipa_argument_spec()\n    argument_spec.update(\n        krbcanonicalname=dict(type='str', required=True, aliases=['name']),\n        force=dict(type='bool', required=False),\n        hosts=dict(type='list', required=False, elements='str'),\n        state=dict(type='str', required=False, default='present',\n                   choices=['present', 'absent']))\n\n    module = AnsibleModule(argument_spec=argument_spec,\n                           supports_check_mode=True)\n\n    client = ServiceIPAClient(module=module,\n                              host=module.params['ipa_host'],\n                              port=module.params['ipa_port'],\n                              protocol=module.params['ipa_prot'])\n\n    try:\n        client.login(username=module.params['ipa_user'],\n                     password=module.params['ipa_pass'])\n        changed, host = ensure(module, client)\n        module.exit_json(changed=changed, host=host)\n    except Exception as e:\n        module.fail_json(msg=to_native(e), exception=traceback.format_exc())\n\n\nif __name__ == '__main__':\n    main()\n", "path": "plugins/modules/identity/ipa/ipa_service.py"}], "after_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n# Copyright: (c) 2018, Ansible Project\n# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)\n\nfrom __future__ import absolute_import, division, print_function\n__metaclass__ = type\n\nDOCUMENTATION = r'''\n---\nmodule: ipa_service\nauthor: C\u00e9dric Parent (@cprh)\nshort_description: Manage FreeIPA service\ndescription:\n- Add and delete an IPA service using IPA API.\noptions:\n  krbcanonicalname:\n    description:\n    - Principal of the service.\n    - Can not be changed as it is the unique identifier.\n    required: true\n    aliases: [\"name\"]\n    type: str\n  hosts:\n    description:\n    - Defines the list of 'ManagedBy' hosts.\n    required: false\n    type: list\n    elements: str\n  force:\n    description:\n    - Force principal name even if host is not in DNS.\n    required: false\n    type: bool\n  skip_host_check:\n    description:\n    - Force service to be created even when host object does not exist to manage it.\n    - This is only used on creation, not for updating existing services.\n    required: false\n    type: bool\n    default: false\n    version_added: 4.7.0\n  state:\n    description: State to ensure.\n    required: false\n    default: present\n    choices: [\"absent\", \"present\"]\n    type: str\nextends_documentation_fragment:\n- community.general.ipa.documentation\n\n'''\n\nEXAMPLES = r'''\n- name: Ensure service is present\n  community.general.ipa_service:\n    name: http/host01.example.com\n    state: present\n    ipa_host: ipa.example.com\n    ipa_user: admin\n    ipa_pass: topsecret\n\n- name: Ensure service is absent\n  community.general.ipa_service:\n    name: http/host01.example.com\n    state: absent\n    ipa_host: ipa.example.com\n    ipa_user: admin\n    ipa_pass: topsecret\n\n- name: Changing Managing hosts list\n  community.general.ipa_service:\n    name: http/host01.example.com\n    hosts:\n       - host01.example.com\n       - host02.example.com\n    ipa_host: ipa.example.com\n    ipa_user: admin\n    ipa_pass: topsecret\n'''\n\nRETURN = r'''\nservice:\n  description: Service as returned by IPA API.\n  returned: always\n  type: dict\n'''\n\nimport traceback\n\nfrom ansible.module_utils.basic import AnsibleModule\nfrom ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec\nfrom ansible.module_utils.common.text.converters import to_native\n\n\nclass ServiceIPAClient(IPAClient):\n    def __init__(self, module, host, port, protocol):\n        super(ServiceIPAClient, self).__init__(module, host, port, protocol)\n\n    def service_find(self, name):\n        return self._post_json(method='service_find', name=None, item={'all': True, 'krbcanonicalname': name})\n\n    def service_add(self, name, service):\n        return self._post_json(method='service_add', name=name, item=service)\n\n    def service_mod(self, name, service):\n        return self._post_json(method='service_mod', name=name, item=service)\n\n    def service_del(self, name):\n        return self._post_json(method='service_del', name=name)\n\n    def service_disable(self, name):\n        return self._post_json(method='service_disable', name=name)\n\n    def service_add_host(self, name, item):\n        return self._post_json(method='service_add_host', name=name, item={'host': item})\n\n    def service_remove_host(self, name, item):\n        return self._post_json(method='service_remove_host', name=name, item={'host': item})\n\n\ndef get_service_dict(force=None, krbcanonicalname=None, skip_host_check=None):\n    data = {}\n    if force is not None:\n        data['force'] = force\n    if krbcanonicalname is not None:\n        data['krbcanonicalname'] = krbcanonicalname\n    if skip_host_check is not None:\n        data['skip_host_check'] = skip_host_check\n    return data\n\n\ndef get_service_diff(client, ipa_host, module_service):\n    non_updateable_keys = ['force', 'krbcanonicalname', 'skip_host_check']\n    for key in non_updateable_keys:\n        if key in module_service:\n            del module_service[key]\n\n    return client.get_diff(ipa_data=ipa_host, module_data=module_service)\n\n\ndef ensure(module, client):\n    name = module.params['krbcanonicalname']\n    state = module.params['state']\n    hosts = module.params['hosts']\n\n    ipa_service = client.service_find(name=name)\n    module_service = get_service_dict(force=module.params['force'], skip_host_check=module.params['skip_host_check'])\n    changed = False\n    if state in ['present', 'enabled', 'disabled']:\n        if not ipa_service:\n            changed = True\n            if not module.check_mode:\n                client.service_add(name=name, service=module_service)\n        else:\n            diff = get_service_diff(client, ipa_service, module_service)\n            if len(diff) > 0:\n                changed = True\n                if not module.check_mode:\n                    data = {}\n                    for key in diff:\n                        data[key] = module_service.get(key)\n                    client.service_mod(name=name, service=data)\n        if hosts is not None:\n            if 'managedby_host' in ipa_service:\n                for host in ipa_service['managedby_host']:\n                    if host not in hosts:\n                        if not module.check_mode:\n                            client.service_remove_host(name=name, item=host)\n                        changed = True\n                for host in hosts:\n                    if host not in ipa_service['managedby_host']:\n                        if not module.check_mode:\n                            client.service_add_host(name=name, item=host)\n                        changed = True\n            else:\n                for host in hosts:\n                    if not module.check_mode:\n                        client.service_add_host(name=name, item=host)\n                    changed = True\n\n    else:\n        if ipa_service:\n            changed = True\n            if not module.check_mode:\n                client.service_del(name=name)\n\n    return changed, client.service_find(name=name)\n\n\ndef main():\n    argument_spec = ipa_argument_spec()\n    argument_spec.update(\n        krbcanonicalname=dict(type='str', required=True, aliases=['name']),\n        force=dict(type='bool', required=False),\n        skip_host_check=dict(type='bool', default=False, required=False),\n        hosts=dict(type='list', required=False, elements='str'),\n        state=dict(type='str', required=False, default='present',\n                   choices=['present', 'absent']))\n\n    module = AnsibleModule(argument_spec=argument_spec,\n                           supports_check_mode=True)\n\n    client = ServiceIPAClient(module=module,\n                              host=module.params['ipa_host'],\n                              port=module.params['ipa_port'],\n                              protocol=module.params['ipa_prot'])\n\n    try:\n        client.login(username=module.params['ipa_user'],\n                     password=module.params['ipa_pass'])\n        changed, host = ensure(module, client)\n        module.exit_json(changed=changed, host=host)\n    except Exception as e:\n        module.fail_json(msg=to_native(e), exception=traceback.format_exc())\n\n\nif __name__ == '__main__':\n    main()\n", "path": "plugins/modules/identity/ipa/ipa_service.py"}]}