Debian Codegraph @

ansible_collections/theforeman/foreman/plugins/modules/scap_tailoring_file.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: scap_tailoring_file
25 version_added: 1.0.0
26 short_description: Manage SCAP Tailoring Files
27 description:
28 - Create, update, and delete SCAP Tailoring Files
29 author:
30 - "Evgeni Golov (@evgeni)"
31 options:
32 name:
33 description:
34 - Name of the tailoring file.
35 required: true
36 type: str
37 updated_name:
38 description:
39 - New name of the tailoring file.
40 - When this parameter is set, the module will not be idempotent.
41 type: str
42 extends_documentation_fragment:
43 - theforeman.foreman.foreman
44 - theforeman.foreman.foreman.entity_state
45 - theforeman.foreman.foreman.taxonomy
46 - theforeman.foreman.foreman.scap_datastream
47 '''
48
49 EXAMPLES = '''
50 - name: Create SCAP tailoring file
51 theforeman.foreman.scap_tailoring_file:
52 name: "Red Hat firefox default content"
53 scap_file: "/home/user/Downloads/ssg-firefox-ds-tailoring.xml"
54 original_filename: "ssg-firefox-ds-tailoring.xml"
55 organizations:
56 - "Default Organization"
57 locations:
58 - "Default Location"
59 server_url: "https://foreman.example.com"
60 username: "admin"
61 password: "changeme"
62 state: present
63
64 - name: Update SCAP tailoring file
65 theforeman.foreman.scap_tailoring_file:
66 name: "Red Hat firefox default content"
67 updated_name: "Updated tailoring file name"
68 scap_file: "/home/user/Downloads/updated-ssg-firefox-ds-tailoring.xml"
69 original_filename: "updated-ssg-firefox-ds-tailoring.xml"
70 organizations:
71 - "Org One"
72 - "Org Two"
73 locations:
74 - "Loc One"
75 - "Loc Two"
76 server_url: "https://foreman.example.com"
77 username: "admin"
78 password: "changeme"
79 state: present
80
81 - name: Delete SCAP tailoring file
82 theforeman.foreman.scap_tailoring_file:
83 name: "Red Hat firefox default content"
84 server_url: "https://foreman.example.com"
85 username: "admin"
86 password: "changeme"
87 state: absent
88 '''
89
90 RETURN = '''
91 entity:
92 description: Final state of the affected entities grouped by their type.
93 returned: success
94 type: dict
95 contains:
96 scap_tailoring_files:
97 description: List of scap tailoring files.
98 type: list
99 elements: dict
100 '''
101
102 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import ForemanScapDataStreamModule
103
104
105 class ForemanTailoringFileModule(ForemanScapDataStreamModule):
106 pass
107
108
109 def main():
110 module = ForemanTailoringFileModule(
111 argument_spec=dict(
112 updated_name=dict(type='str'),
113 ),
114 foreman_spec=dict(
115 name=dict(type='str', required=True),
116 ),
117 required_plugins=[('openscap', ['*'])],
118 )
119
120 with module.api_connection():
121 module.run()
122
123
124 if __name__ == '__main__':
125 main()