Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) 2022, Jeremy Lenz <[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: content_export_library
25 version_added: 3.5.0
26 short_description: Manage library content exports
27 description:
28 - Export library content to a directory.
29 author:
30 - "Jeremy Lenz (@jeremylenz)"
31 options:
32 destination_server:
33 description:
34 - Destination server name; optional parameter to differentiate between exports
35 required: false
36 type: str
37 fail_on_missing_content:
38 description:
39 - Fails if any of the repositories belonging to this organization are unexportable.
40 required: false
41 type: bool
42 extends_documentation_fragment:
43 - theforeman.foreman.foreman
44 - theforeman.foreman.foreman.organization
45 - theforeman.foreman.foreman.katelloexport
46 '''
47
48 EXAMPLES = '''
49 - name: "Export library content (full)"
50 theforeman.foreman.content_export_library:
51 username: "admin"
52 password: "changeme"
53 server_url: "https://foreman.example.com"
54 organization: "Default Organization"
55 destination_server: "airgapped.example.com"
56
57 - name: "Export library content (full) and fail if any repos are unexportable"
58 theforeman.foreman.content_export_library:
59 username: "admin"
60 password: "changeme"
61 server_url: "https://foreman.example.com"
62 organization: "Default Organization"
63 destination_server: "airgapped.example.com"
64 fail_on_missing_content: true
65
66 - name: "Export library content (full) in chunks of 10 GB"
67 theforeman.foreman.content_export_library:
68 username: "admin"
69 password: "changeme"
70 server_url: "https://foreman.example.com"
71 chunk_size_gb: 10
72 organization: "Default Organization"
73 destination_server: "airgapped.example.com"
74
75 - name: "Export library content (incremental) since the most recent export"
76 theforeman.foreman.content_export_library:
77 username: "admin"
78 password: "changeme"
79 server_url: "https://foreman.example.com"
80 organization: "Default Organization"
81 destination_server: "airgapped.example.com"
82 incremental: true
83
84 - name: "Export library content (incremental) since a specific export"
85 theforeman.foreman.content_export_library:
86 username: "admin"
87 password: "changeme"
88 server_url: "https://foreman.example.com"
89 organization: "Default Organization"
90 destination_server: "airgapped.example.com"
91 incremental: true
92 from_history_id: 12345
93 '''
94
95 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import KatelloContentExportBaseModule
96
97
98 class KatelloContentExportModule(KatelloContentExportBaseModule):
99 pass
100
101
102 def main():
103 module = KatelloContentExportModule(
104 foreman_spec=dict(
105 destination_server=dict(required=False, type='str'),
106 fail_on_missing_content=dict(required=False, type='bool'),
107 ),
108 export_action='library'
109 )
110
111 with module.api_connection():
112 module.run()
113
114
115 if __name__ == '__main__':
116 main()