Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) 2019 Baptiste Agasse
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: config_group
25 version_added: 1.0.0
26 short_description: Manage (Puppet) Config Groups
27 description:
28 - Create, update, and delete (Puppet) config groups
29 author:
30 - "Baptiste Agasse (@bagasse)"
31 options:
32 name:
33 description: The config group name
34 required: true
35 type: str
36 updated_name:
37 description: New config group name. When this parameter is set, the module will not be idempotent.
38 type: str
39 puppetclasses:
40 description: List of puppet classes to include in this group
41 required: false
42 type: list
43 elements: str
44 extends_documentation_fragment:
45 - theforeman.foreman.foreman
46 - theforeman.foreman.foreman.entity_state
47 '''
48
49 EXAMPLES = '''
50 - name: create new config group
51 theforeman.foreman.config_group:
52 name: "My config group"
53 puppetclasses:
54 - ntp
55 - mymodule::myclass
56 server_url: "https://foreman.example.com"
57 username: "admin"
58 password: "changeme"
59 state: present
60 '''
61
62 RETURN = '''
63 entity:
64 description: Final state of the affected entities grouped by their type.
65 returned: success
66 type: dict
67 contains:
68 config_groups:
69 description: List of config groups.
70 type: list
71 elements: dict
72 '''
73
74 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import ForemanEntityAnsibleModule
75
76
77 class ForemanConfigGroupModule(ForemanEntityAnsibleModule):
78 pass
79
80
81 def main():
82 module = ForemanConfigGroupModule(
83 argument_spec=dict(
84 updated_name=dict(),
85 ),
86 foreman_spec=dict(
87 name=dict(required=True),
88 puppetclasses=dict(type='entity_list'),
89 ),
90 )
91
92 with module.api_connection():
93 module.run()
94
95
96 if __name__ == '__main__':
97 main()