Debian Codegraph @

ansible_collections/theforeman/foreman/plugins/modules/realm.py

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) 2017, Lester R Claudio <[email protected]>
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 from __future__ import absolute_import, division, print_function
19 __metaclass__ = type
20
21
22 DOCUMENTATION = '''
23 ---
24 module: realm
25 version_added: 1.0.0
26 short_description: Manage Realms
27 description:
28 - Manage Realms
29 author:
30 - "Lester R Claudio (@claudiol1)"
31 options:
32 name:
33 description:
34 - Name of the realm
35 required: true
36 type: str
37 realm_proxy:
38 description:
39 - Proxy to use for this realm
40 required: true
41 type: str
42 realm_type:
43 description:
44 - Realm type
45 choices:
46 - Red Hat Identity Management
47 - FreeIPA
48 - Active Directory
49 required: true
50 type: str
51 extends_documentation_fragment:
52 - theforeman.foreman.foreman
53 - theforeman.foreman.foreman.entity_state
54 - theforeman.foreman.foreman.taxonomy
55 '''
56
57 EXAMPLES = '''
58 - name: "Create EXAMPLE.LOCAL Realm"
59 theforeman.foreman.realm:
60 username: "admin"
61 password: "changeme"
62 server_url: "https://foreman.example.com"
63 name: "EXAMPLE.COM"
64 realm_proxy: "foreman.example.com"
65 realm_type: "Red Hat Identity Management"
66 state: present
67 '''
68
69 RETURN = '''
70 entity:
71 description: Final state of the affected entities grouped by their type.
72 returned: success
73 type: dict
74 contains:
75 realms:
76 description: List of realms.
77 type: list
78 elements: dict
79 '''
80
81 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import ForemanTaxonomicEntityAnsibleModule
82
83
84 class ForemanRealmModule(ForemanTaxonomicEntityAnsibleModule):
85 pass
86
87
88 def main():
89 module = ForemanRealmModule(
90 foreman_spec=dict(
91 name=dict(required=True),
92 realm_proxy=dict(type='entity', required=True, resource_type='smart_proxies'),
93 realm_type=dict(required=True, choices=['Red Hat Identity Management', 'FreeIPA', 'Active Directory']),
94 ),
95 )
96
97 with module.api_connection():
98 module.run()
99
100
101 if __name__ == '__main__':
102 main()