Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) 2018, Baptiste Agasse <[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_credential
25 version_added: 1.0.0
26 short_description: Manage Content Credentials
27 description:
28 - Create and manage content credentials
29 author: "Baptiste Agasse (@bagasse)"
30 options:
31 name:
32 description:
33 - Name of the content credential
34 required: true
35 type: str
36 content_type:
37 description:
38 - Type of credential
39 - Required when creating a new credential
40 choices:
41 - gpg_key
42 - cert
43 type: str
44 content:
45 description:
46 - Content of the content credential
47 - Required when creating a new credential
48 type: str
49 extends_documentation_fragment:
50 - theforeman.foreman.foreman
51 - theforeman.foreman.foreman.entity_state
52 - theforeman.foreman.foreman.organization
53 '''
54
55 EXAMPLES = '''
56 - name: "Create katello client GPG key"
57 theforeman.foreman.content_credential:
58 username: "admin"
59 password: "changeme"
60 server_url: "https://foreman.example.com"
61 name: "RPM-GPG-KEY-my-repo"
62 content_type: gpg_key
63 organization: "Default Organization"
64 content: "{{ lookup('file', 'RPM-GPG-KEY-my-repo') }}"
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 content_credentials:
74 description: List of content credentials.
75 type: list
76 elements: dict
77 '''
78
79 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import KatelloEntityAnsibleModule
80
81
82 class KatelloContentCredentialModule(KatelloEntityAnsibleModule):
83 pass
84
85
86 def main():
87 module = KatelloContentCredentialModule(
88 foreman_spec=dict(
89 name=dict(required=True),
90 content_type=dict(choices=['gpg_key', 'cert']),
91 content=dict(),
92 ),
93 )
94
95 with module.api_connection():
96 module.run()
97
98
99 if __name__ == '__main__':
100 main()