Skip to content

Commit ec28ed1

Browse files
committed
add incomplete module
1 parent 40d320d commit ec28ed1

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/python
2+
# Copyright (c) 2025 Ansible Project
3+
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
5+
from __future__ import absolute_import, division, print_function
6+
__metaclass__ = type
7+
8+
DOCUMENTATION = r'''
9+
module: podman_system_info
10+
author:
11+
- Johnson Lien (@johnsonlien)
12+
short_description: Get podman system information from host machine
13+
description: Runs "podman system info" on host machine
14+
'''
15+
16+
EXAMPLES = r'''
17+
- name: Get Podman system information
18+
containers.podman.podman_system_info:
19+
'''
20+
21+
RETURN = r'''
22+
'''
23+
24+
import json
25+
26+
from ansible.module_utils.basic import AnsibleModule
27+
28+
def get_podman_system_info(module, executable):
29+
command = [executable, 'system', 'info']
30+
rc, out, err = module.run_command(command)
31+
out = out.strip()
32+
if out:
33+
return out
34+
35+
return json.dumps([])
36+
37+
def main():
38+
module = AnsibleModule(
39+
argument_spec=dict(
40+
executable=dict(type='str', default='podman'),
41+
name=dict(type='list', elements='str')
42+
),
43+
supports_check_mode=True,
44+
)
45+
46+
executable = module.params['executable']
47+
name = module.params.get('name')
48+
executable = module.get_bin_path(executable, required=True)
49+
50+
results = get_podman_system_info(module, executable)
51+
52+
results = dict(
53+
changed=False,
54+
podman_system_info=results,
55+
)
56+
57+
module.exit_json(**results)
58+
59+
if __name__ == '__main__':
60+
main()

0 commit comments

Comments
 (0)