Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) 2018 Markus Bucher (ATIX AG)
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: domain
25 version_added: 1.0.0
26 short_description: Manage Domains
27 description:
28 - Create, update, and delete Domains
29 author:
30 - "Markus Bucher (@m-bucher) ATIX AG"
31 options:
32 name:
33 description: The full DNS domain name
34 required: true
35 type: str
36 updated_name:
37 description: New domain name. When this parameter is set, the module will not be idempotent.
38 type: str
39 dns_proxy:
40 aliases:
41 - dns
42 description: DNS proxy to use within this domain for managing A records
43 required: false
44 type: str
45 description:
46 aliases:
47 - fullname
48 description: Full name describing the domain
49 required: false
50 type: str
51 parameters:
52 description:
53 - Domain specific host parameters
54 extends_documentation_fragment:
55 - theforeman.foreman.foreman
56 - theforeman.foreman.foreman.entity_state
57 - theforeman.foreman.foreman.taxonomy
58 - theforeman.foreman.foreman.nested_parameters
59 '''
60
61 EXAMPLES = '''
62 - name: domain
63 theforeman.foreman.domain:
64 name: "example.org"
65 description: "Example Domain"
66 locations:
67 - "Munich"
68 organizations:
69 - "ACME"
70 server_url: "https://foreman.example.com"
71 username: "admin"
72 password: "changeme"
73 state: present
74 '''
75
76 RETURN = '''
77 entity:
78 description: Final state of the affected entities grouped by their type.
79 returned: success
80 type: dict
81 contains:
82 domains:
83 description: List of domains.
84 type: list
85 elements: dict
86 '''
87
88 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import ForemanTaxonomicEntityAnsibleModule, ParametersMixin
89
90
91 class ForemanDomainModule(ParametersMixin, ForemanTaxonomicEntityAnsibleModule):
92 pass
93
94
95 def main():
96 module = ForemanDomainModule(
97 argument_spec=dict(
98 updated_name=dict(),
99 ),
100 foreman_spec=dict(
101 name=dict(required=True),
102 description=dict(aliases=['fullname'], flat_name='fullname'),
103 dns_proxy=dict(type='entity', flat_name='dns_id', aliases=['dns'], resource_type='smart_proxies'),
104 ),
105 )
106
107 with module.api_connection():
108 module.run()
109
110
111 if __name__ == '__main__':
112 main()