Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) 2020, Evgeni Golov <[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: hardware_model
25 version_added: 1.0.0
26 short_description: Manage Hardware Models
27 description:
28 - Manage hardware models
29 author:
30 - "Evgeni Golov (@evgeni)"
31 options:
32 name:
33 description:
34 - Name of the hardware model
35 required: true
36 type: str
37 info:
38 description:
39 - General description of the hardware model
40 type: str
41 vendor_class:
42 description:
43 - The class of the machine as reported by the OpenBoot PROM.
44 - This is primarily used by Solaris SPARC builds and can be left blank for other architectures.
45 type: str
46 hardware_model:
47 description:
48 - The class of CPU supplied in this machine.
49 - This is primarily used by Sparc Solaris builds and can be left blank for other architectures.
50 type: str
51 extends_documentation_fragment:
52 - theforeman.foreman.foreman
53 - theforeman.foreman.foreman.entity_state
54 '''
55
56 EXAMPLES = '''
57 - name: "Create ACME Laptop model"
58 theforeman.foreman.hardware_model:
59 username: "admin"
60 password: "changeme"
61 server_url: "https://foreman.example.com"
62 name: "acme laptop"
63 info: "this is the acme laptop"
64 state: present
65 '''
66
67 RETURN = '''
68 entity:
69 description: Final state of the affected entities grouped by their type.
70 returned: success
71 type: dict
72 contains:
73 hardware_models:
74 description: List of hardware models.
75 type: list
76 elements: dict
77 '''
78
79
80 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import ForemanEntityAnsibleModule
81
82
83 class ForemanModelModule(ForemanEntityAnsibleModule):
84 pass
85
86
87 def main():
88 module = ForemanModelModule(
89 foreman_spec=dict(
90 name=dict(required=True),
91 info=dict(),
92 vendor_class=dict(),
93 hardware_model=dict(),
94 ),
95 )
96
97 with module.api_connection():
98 module.run()
99
100
101 if __name__ == '__main__':
102 main()