Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) 2019, Maxim Burgerhout <[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: host_collection
25 version_added: 1.0.0
26 short_description: Manage Host Collections
27 description:
28 - Create and Manage host collections
29 author:
30 - "Maxim Burgerhout (@wzzrd)"
31 - "Christoffer Reijer (@ephracis)"
32 options:
33 description:
34 description:
35 - Description of the host collection
36 required: false
37 type: str
38 name:
39 description:
40 - Name of the host collection
41 required: true
42 type: str
43 updated_name:
44 description:
45 - New name of the host collection. When this parameter is set, the module will not be idempotent.
46 type: str
47 extends_documentation_fragment:
48 - theforeman.foreman.foreman
49 - theforeman.foreman.foreman.entity_state
50 - theforeman.foreman.foreman.organization
51 '''
52
53 EXAMPLES = '''
54 - name: "Create Foo host collection"
55 theforeman.foreman.host_collection:
56 username: "admin"
57 password: "changeme"
58 server_url: "https://foreman.example.com"
59 name: "Foo"
60 description: "Foo host collection for Foo servers"
61 organization: "My Cool new Organization"
62 state: present
63 '''
64
65 RETURN = '''
66 entity:
67 description: Final state of the affected entities grouped by their type.
68 returned: success
69 type: dict
70 contains:
71 host_collections:
72 description: List of host collections.
73 type: list
74 elements: dict
75 '''
76
77 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import KatelloEntityAnsibleModule
78
79
80 class KatelloHostCollectionModule(KatelloEntityAnsibleModule):
81 pass
82
83
84 def main():
85 module = KatelloHostCollectionModule(
86 argument_spec=dict(
87 updated_name=dict(),
88 ),
89 foreman_spec=dict(
90 name=dict(required=True),
91 description=dict(),
92 ),
93 )
94
95 with module.api_connection():
96 module.run()
97
98
99 if __name__ == '__main__':
100 main()