|
10 | 10 | author: |
11 | 11 | - Johnson Lien (@johnsonlien) |
12 | 12 | short_description: Get podman system information from host machine |
13 | | -description: Runs "podman system info" on host machine |
| 13 | +description: Runs "podman system info --format json" on host machine |
14 | 14 | ''' |
15 | 15 |
|
16 | 16 | EXAMPLES = r''' |
|
19 | 19 | ''' |
20 | 20 |
|
21 | 21 | RETURN = r''' |
| 22 | +{ |
| 23 | + "host": { |
| 24 | + "arch": "amd64", |
| 25 | + "buildahVersion": "1.23.0", |
| 26 | + "cgroupManager": "systemd", |
| 27 | + "cgroupVersion": "v2", |
| 28 | + "cgroupControllers": [], |
| 29 | + "conmon": { |
| 30 | + "package": "conmon-2.0.29-2.fc34.x86_64", |
| 31 | + "path": "/usr/bin/conmon", |
| 32 | + "version": "conmon version 2.0.29, commit: " |
| 33 | + }, |
| 34 | + "cpus": 8, |
| 35 | + "distribution": { |
| 36 | + "distribution": "fedora", |
| 37 | + "version": "34" |
| 38 | + }, |
| 39 | + "eventLogger": "journald", |
| 40 | + "hostname": "localhost.localdomain", |
| 41 | + "idMappings": { |
| 42 | + "gidmap": [ |
| 43 | + { |
| 44 | + "container_id": 0, |
| 45 | + "host_id": 3267, |
| 46 | + "size": 1 |
| 47 | + }, |
| 48 | + { |
| 49 | + "container_id": 1, |
| 50 | + "host_id": 100000, |
| 51 | + "size": 65536 |
| 52 | + } |
| 53 | + ], |
| 54 | + "uidmap": [ |
| 55 | + { |
| 56 | + "container_id": 0, |
| 57 | + "host_id": 3267, |
| 58 | + "size": 1 |
| 59 | + }, |
| 60 | + { |
| 61 | + "container_id": 1, |
| 62 | + "host_id": 100000, |
| 63 | + "size": 65536 |
| 64 | + } |
| 65 | + ] |
| 66 | + }, |
| 67 | + "kernel": "5.13.13-200.fc34.x86_64", |
| 68 | + "logDriver": "journald", |
| 69 | + "memFree": 1785753600, |
| 70 | + "memTotal": 16401895424, |
| 71 | + "networkBackend": "cni", |
| 72 | + "networkBackendInfo": { |
| 73 | + "backend": "cni", |
| 74 | + "package": "containernetworking-plugins-1.0.1-1.fc34.x86_64\npodman-plugins-3.4.4-1.fc34.x86_64", |
| 75 | + "path": "/usr/libexec/cni", |
| 76 | + "dns": { |
| 77 | + "version": "CNI dnsname plugin\nversion: 1.3.1\ncommit: unknown", |
| 78 | + "package": "podman-plugins-3.4.4-1.fc34.x86_64", |
| 79 | + "path": "/usr/libexec/cni/dnsname" |
| 80 | + } |
| 81 | + }, |
| 82 | + "ociRuntime": { |
| 83 | + "name": "crun", |
| 84 | + "package": "crun-1.0-1.fc34.x86_64", |
| 85 | + "path": "/usr/bin/crun", |
| 86 | + "version": "crun version 1.0\ncommit: 139dc6971e2f1d931af520188763e984d6cdfbf8\nspec: 1.0.0\n+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL" |
| 87 | + }, |
| 88 | + "os": "linux", |
| 89 | + "remoteSocket": { |
| 90 | + "path": "/run/user/3267/podman/podman.sock" |
| 91 | + }, |
| 92 | + "serviceIsRemote": false, |
| 93 | + "security": { |
| 94 | + "apparmorEnabled": false, |
| 95 | + "capabilities": "CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID", |
| 96 | + "rootless": true, |
| 97 | + "seccompEnabled": true, |
| 98 | + "seccompProfilePath": "/usr/share/containers/seccomp.json", |
| 99 | + "selinuxEnabled": true |
| 100 | + }, |
| 101 | + "slirp4netns": { |
| 102 | + "executable": "/bin/slirp4netns", |
| 103 | + "package": "slirp4netns-1.1.12-2.fc34.x86_64", |
| 104 | + "version": "slirp4netns version 1.1.12\ncommit: 7a104a101aa3278a2152351a082a6df71f57c9a3\nlibslirp: 4.4.0\nSLIRP_CONFIG_VERSION_MAX: 3\nlibseccomp: 2.5.0" |
| 105 | + }, |
| 106 | + "pasta": { |
| 107 | + "executable": "/usr/bin/passt", |
| 108 | + "package": "passt-0^20221116.gace074c-1.fc34.x86_64", |
| 109 | + "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" |
| 110 | + }, |
| 111 | + "swapFree": 15687475200, |
| 112 | + "swapTotal": 16886259712, |
| 113 | + "uptime": "47h 17m 29.75s (Approximately 1.96 days)", |
| 114 | + "linkmode": "dynamic" |
| 115 | + }, |
| 116 | + "store": { |
| 117 | + "configFile": "/home/dwalsh/.config/containers/storage.conf", |
| 118 | + "containerStore": { |
| 119 | + "number": 9, |
| 120 | + "paused": 0, |
| 121 | + "running": 1, |
| 122 | + "stopped": 8 |
| 123 | + }, |
| 124 | + "graphDriverName": "overlay", |
| 125 | + "graphOptions": { |
| 126 | +
|
| 127 | + }, |
| 128 | + "graphRoot": "/home/dwalsh/.local/share/containers/storage", |
| 129 | + "graphStatus": { |
| 130 | + "Backing Filesystem": "extfs", |
| 131 | + "Native Overlay Diff": "true", |
| 132 | + "Supports d_type": "true", |
| 133 | + "Using metacopy": "false" |
| 134 | + }, |
| 135 | + "imageCopyTmpDir": "/home/dwalsh/.local/share/containers/storage/tmp", |
| 136 | + "imageStore": { |
| 137 | + "number": 5 |
| 138 | + }, |
| 139 | + "runRoot": "/run/user/3267/containers", |
| 140 | + "volumePath": "/home/dwalsh/.local/share/containers/storage/volumes", |
| 141 | + "transientStore": false |
| 142 | + }, |
| 143 | + "registries": { |
| 144 | + "search": [ |
| 145 | + "registry.fedoraproject.org", |
| 146 | + "registry.access.redhat.com", |
| 147 | + "docker.io", |
| 148 | + "quay.io" |
| 149 | +] |
| 150 | + }, |
| 151 | + "plugins": { |
| 152 | + "volume": [ |
| 153 | + "local" |
| 154 | + ], |
| 155 | + "network": [ |
| 156 | + "bridge", |
| 157 | + "macvlan" |
| 158 | + ], |
| 159 | + "log": [ |
| 160 | + "k8s-file", |
| 161 | + "none", |
| 162 | + "journald" |
| 163 | + ] |
| 164 | + }, |
| 165 | + "version": { |
| 166 | + "APIVersion": "4.0.0", |
| 167 | + "Version": "4.0.0", |
| 168 | + "GoVersion": "go1.16.6", |
| 169 | + "GitCommit": "23677f92dd83e96d2bc8f0acb611865fb8b1a56d", |
| 170 | + "BuiltTime": "Tue Sep 14 15:45:22 2021", |
| 171 | + "Built": 1631648722, |
| 172 | + "OsArch": "linux/amd64" |
| 173 | + } |
| 174 | +} |
22 | 175 | ''' |
23 | 176 |
|
24 | 177 | import json |
25 | 178 |
|
26 | 179 | from ansible.module_utils.basic import AnsibleModule |
27 | 180 |
|
28 | 181 | def get_podman_system_info(module, executable): |
29 | | - command = [executable, 'system', 'info'] |
| 182 | + command = [executable, 'system', 'info', '--format', 'json'] |
30 | 183 | rc, out, err = module.run_command(command) |
31 | 184 | out = out.strip() |
32 | 185 | if out: |
|
0 commit comments