Skip to content

Commit 1c857fe

Browse files
committed
have RETURN be yaml format
Signed-off-by: johnsonlien <[email protected]>
1 parent ddb0d51 commit 1c857fe

File tree

1 file changed

+144
-153
lines changed

1 file changed

+144
-153
lines changed

plugins/modules/podman_system_info.py

Lines changed: 144 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -26,158 +26,149 @@
2626
'''
2727

2828
RETURN = r'''
29-
{
30-
"host": {
31-
"arch": "amd64",
32-
"buildahVersion": "1.23.0",
33-
"cgroupManager": "systemd",
34-
"cgroupVersion": "v2",
35-
"cgroupControllers": [],
36-
"conmon": {
37-
"package": "conmon-2.0.29-2.fc34.x86_64",
38-
"path": "/usr/bin/conmon",
39-
"version": "conmon version 2.0.29, commit: "
40-
},
41-
"cpus": 8,
42-
"distribution": {
43-
"distribution": "fedora",
44-
"version": "34"
45-
},
46-
"eventLogger": "journald",
47-
"hostname": "localhost.localdomain",
48-
"idMappings": {
49-
"gidmap": [
50-
{
51-
"container_id": 0,
52-
"host_id": 3267,
53-
"size": 1
54-
},
55-
{
56-
"container_id": 1,
57-
"host_id": 100000,
58-
"size": 65536
59-
}
60-
],
61-
"uidmap": [
62-
{
63-
"container_id": 0,
64-
"host_id": 3267,
65-
"size": 1
66-
},
67-
{
68-
"container_id": 1,
69-
"host_id": 100000,
70-
"size": 65536
71-
}
72-
]
73-
},
74-
"kernel": "5.13.13-200.fc34.x86_64",
75-
"logDriver": "journald",
76-
"memFree": 1785753600,
77-
"memTotal": 16401895424,
78-
"networkBackend": "cni",
79-
"networkBackendInfo": {
80-
"backend": "cni",
81-
"package": "containernetworking-plugins-1.0.1-1.fc34.x86_64\npodman-plugins-3.4.4-1.fc34.x86_64",
82-
"path": "/usr/libexec/cni",
83-
"dns": {
84-
"version": "CNI dnsname plugin\nversion: 1.3.1\ncommit: unknown",
85-
"package": "podman-plugins-3.4.4-1.fc34.x86_64",
86-
"path": "/usr/libexec/cni/dnsname"
87-
}
88-
},
89-
"ociRuntime": {
90-
"name": "crun",
91-
"package": "crun-1.0-1.fc34.x86_64",
92-
"path": "/usr/bin/crun",
93-
"version": "crun version 1.0\ncommit: 139dc6971e2f1d931af520188763e984d6cdfbf8\nspec: 1.0.0\n+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL"
94-
},
95-
"os": "linux",
96-
"remoteSocket": {
97-
"path": "/run/user/3267/podman/podman.sock"
98-
},
99-
"serviceIsRemote": false,
100-
"security": {
101-
"apparmorEnabled": false,
102-
"capabilities": "CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID",
103-
"rootless": true,
104-
"seccompEnabled": true,
105-
"seccompProfilePath": "/usr/share/containers/seccomp.json",
106-
"selinuxEnabled": true
107-
},
108-
"slirp4netns": {
109-
"executable": "/bin/slirp4netns",
110-
"package": "slirp4netns-1.1.12-2.fc34.x86_64",
111-
"version": "slirp4netns version 1.1.12\ncommit: 7a104a101aa3278a2152351a082a6df71f57c9a3\nlibslirp: 4.4.0\nSLIRP_CONFIG_VERSION_MAX: 3\nlibseccomp: 2.5.0"
112-
},
113-
"pasta": {
114-
"executable": "/usr/bin/passt",
115-
"package": "passt-0^20221116.gace074c-1.fc34.x86_64",
116-
"version": "passt 0^20221116.gace074c-1.fc34.x86_64\nCopyright Red Hat\nGNU Affero GPL version 3 or later \u003chttps://www.gnu.org/licenses/agpl-3.0.html\u003e\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n"
117-
},
118-
"swapFree": 15687475200,
119-
"swapTotal": 16886259712,
120-
"uptime": "47h 17m 29.75s (Approximately 1.96 days)",
121-
"linkmode": "dynamic"
122-
},
123-
"store": {
124-
"configFile": "/home/dwalsh/.config/containers/storage.conf",
125-
"containerStore": {
126-
"number": 9,
127-
"paused": 0,
128-
"running": 1,
129-
"stopped": 8
130-
},
131-
"graphDriverName": "overlay",
132-
"graphOptions": {
133-
134-
},
135-
"graphRoot": "/home/dwalsh/.local/share/containers/storage",
136-
"graphStatus": {
137-
"Backing Filesystem": "extfs",
138-
"Native Overlay Diff": "true",
139-
"Supports d_type": "true",
140-
"Using metacopy": "false"
141-
},
142-
"imageCopyTmpDir": "/home/dwalsh/.local/share/containers/storage/tmp",
143-
"imageStore": {
144-
"number": 5
145-
},
146-
"runRoot": "/run/user/3267/containers",
147-
"volumePath": "/home/dwalsh/.local/share/containers/storage/volumes",
148-
"transientStore": false
149-
},
150-
"registries": {
151-
"search": [
152-
"registry.fedoraproject.org",
153-
"registry.access.redhat.com",
154-
"docker.io",
155-
"quay.io"
156-
]
157-
},
158-
"plugins": {
159-
"volume": [
160-
"local"
161-
],
162-
"network": [
163-
"bridge",
164-
"macvlan"
165-
],
166-
"log": [
167-
"k8s-file",
168-
"none",
169-
"journald"
170-
]
171-
},
172-
"version": {
173-
"APIVersion": "4.0.0",
174-
"Version": "4.0.0",
175-
"GoVersion": "go1.16.6",
176-
"GitCommit": "23677f92dd83e96d2bc8f0acb611865fb8b1a56d",
177-
"BuiltTime": "Tue Sep 14 15:45:22 2021",
178-
"Built": 1631648722,
179-
"OsArch": "linux/amd64"
180-
}
29+
host:
30+
arch: amd64
31+
buildahVersion: 1.23.0
32+
cgroupControllers: []
33+
cgroupManager: systemd
34+
cgroupVersion: v2
35+
conmon:
36+
package: conmon-2.0.29-2.fc34.x86_64
37+
path: /usr/bin/conmon
38+
version: 'conmon version 2.0.29, commit: '
39+
cpu_utilization:
40+
idle_percent: 96.84
41+
system_percent: 0.71
42+
user_percent: 2.45
43+
cpus: 8
44+
distribution:
45+
distribution: fedora
46+
variant: workstation
47+
version: "34"
48+
eventLogger: journald
49+
hostname: localhost.localdomain
50+
idMappings:
51+
gidmap:
52+
- container_id: 0
53+
host_id: 3267
54+
size: 1
55+
- container_id: 1
56+
host_id: 100000
57+
size: 65536
58+
uidmap:
59+
- container_id: 0
60+
host_id: 3267
61+
size: 1
62+
- container_id: 1
63+
host_id: 100000
64+
size: 65536
65+
kernel: 5.13.13-200.fc34.x86_64
66+
linkmode: dynamic
67+
logDriver: journald
68+
memFree: 1833385984
69+
memTotal: 16401895424
70+
networkBackend: cni
71+
networkBackendInfo:
72+
backend: cni
73+
dns:
74+
package: podman-plugins-3.4.4-1.fc34.x86_64
75+
path: /usr/libexec/cni/dnsname
76+
version: |-
77+
CNI dnsname plugin
78+
version: 1.3.1
79+
commit: unknown
80+
package: |-
81+
containernetworking-plugins-1.0.1-1.fc34.x86_64
82+
podman-plugins-3.4.4-1.fc34.x86_64
83+
path: /usr/libexec/cni
84+
ociRuntime:
85+
name: crun
86+
package: crun-1.0-1.fc34.x86_64
87+
path: /usr/bin/crun
88+
version: |-
89+
crun version 1.0
90+
commit: 139dc6971e2f1d931af520188763e984d6cdfbf8
91+
spec: 1.0.0
92+
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
93+
os: linux
94+
pasta:
95+
executable: /usr/bin/passt
96+
package: passt-0^20221116.gace074c-1.fc34.x86_64
97+
version: |
98+
passt 0^20221116.gace074c-1.fc34.x86_64
99+
Copyright Red Hat
100+
GNU Affero GPL version 3 or later <https://www.gnu.org/licenses/agpl-3.0.html>
101+
This is free software: you are free to change and redistribute it.
102+
There is NO WARRANTY, to the extent permitted by law.
103+
remoteSocket:
104+
path: /run/user/3267/podman/podman.sock
105+
security:
106+
apparmorEnabled: false
107+
capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID
108+
rootless: true
109+
seccompEnabled: true
110+
seccompProfilePath: /usr/share/containers/seccomp.json
111+
selinuxEnabled: true
112+
serviceIsRemote: false
113+
slirp4netns:
114+
executable: /bin/slirp4netns
115+
package: slirp4netns-1.1.12-2.fc34.x86_64
116+
version: |-
117+
slirp4netns version 1.1.12
118+
commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
119+
libslirp: 4.4.0
120+
SLIRP_CONFIG_VERSION_MAX: 3
121+
libseccomp: 2.5.0
122+
swapFree: 15687475200
123+
swapTotal: 16886259712
124+
uptime: 47h 15m 9.91s (Approximately 1.96 days)
125+
plugins:
126+
log:
127+
- k8s-file
128+
- none
129+
- journald
130+
network:
131+
- bridge
132+
- macvlan
133+
volume:
134+
- local
135+
registries:
136+
search:
137+
- registry.fedoraproject.org
138+
- registry.access.redhat.com
139+
- docker.io
140+
- quay.io
141+
store:
142+
configFile: /home/dwalsh/.config/containers/storage.conf
143+
containerStore:
144+
number: 9
145+
paused: 0
146+
running: 1
147+
stopped: 8
148+
graphDriverName: overlay
149+
graphOptions: {}
150+
graphRoot: /home/dwalsh/.local/share/containers/storage
151+
graphRootAllocated: 510389125120
152+
graphRootUsed: 129170714624
153+
graphStatus:
154+
Backing Filesystem: extfs
155+
Native Overlay Diff: "true"
156+
Supports d_type: "true"
157+
Using metacopy: "false"
158+
imageCopyTmpDir: /home/dwalsh/.local/share/containers/storage/tmp
159+
imageStore:
160+
number: 5
161+
runRoot: /run/user/3267/containers
162+
transientStore: false
163+
volumePath: /home/dwalsh/.local/share/containers/storage/volumes
164+
version:
165+
APIVersion: 4.0.0
166+
Built: 1631648722
167+
BuiltTime: Tue Sep 14 15:45:22 2021
168+
GitCommit: 23677f92dd83e96d2bc8f0acb611865fb8b1a56d
169+
GoVersion: go1.16.6
170+
OsArch: linux/amd64
171+
Version: 4.0.0
181172
}
182173
'''
183174

@@ -186,7 +177,7 @@
186177
from ansible.module_utils.basic import AnsibleModule
187178

188179
def get_podman_system_info(module, executable):
189-
command = [executable, 'system', 'info', '--format', 'json']
180+
command = [executable, 'system', 'info']
190181
rc, out, err = module.run_command(command)
191182
out = out.strip()
192183
if out:

0 commit comments

Comments
 (0)