-
-
Notifications
You must be signed in to change notification settings - Fork 164
Add podman system info module #922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
704b236
3142ba4
7f2c399
3ee0c54
e9b1c5d
162ee42
ddb0d51
1c857fe
b576ca5
eec08a8
d69625e
9d10714
c1da79a
79438c1
dcd654f
342857f
a3f28d5
eda19cf
e377ac5
5104c0d
8045bf5
66c0ead
ec2f66d
983ffc8
d00b2de
7b5ec05
42fad01
4a91c22
18d7760
058cd57
285f1fc
6c1f17e
7f2b410
a55474c
fac2e1d
d98cc56
fa4bb59
498c6a7
5e6bf4d
a5f4608
6a7eefb
429be95
ce5e456
7e21a7e
d4aa649
388a628
230f14a
179f219
9aa5d9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| name: Podman system info | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - '.github/workflows/podman_system_info.yml' | ||
| - 'ci/*.yml' | ||
| - 'ci/run_containers_tests.sh' | ||
| - 'ci/playbooks/containers/podman_system_info.yml' | ||
| - 'plugins/modules/podman_system_info.py' | ||
| - 'tests/integration/targets/podman_system_info/**' | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/podman_system_info.yml' | ||
| - 'ci/*.yml' | ||
| - 'ci/run_containers_tests.sh' | ||
| - 'ci/playbooks/containers/podman_system_info.yml' | ||
| - 'plugins/modules/podman_system_info.py' | ||
| - 'tests/integration/targets/podman_system_info/**' | ||
| schedule: | ||
| - cron: 4 0 * * * # Run daily at 0:03 UTC | ||
|
|
||
| jobs: | ||
|
|
||
| test_podman_system_info: | ||
| name: Podman system info ${{ matrix.ansible-version }}-${{ matrix.os || 'ubuntu-22.04' }} | ||
| runs-on: ${{ matrix.os || 'ubuntu-22.04' }} | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| ansible-version: | ||
| - git+https://github.com/ansible/[email protected] | ||
| - git+https://github.com/ansible/ansible.git@devel | ||
| os: | ||
| - ubuntu-22.04 | ||
| python-version: | ||
| - "3.11" | ||
|
|
||
| steps: | ||
|
|
||
| - name: Check out repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Upgrade pip and display Python and PIP versions | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y python*-wheel python*-yaml | ||
| python -m pip install --upgrade pip | ||
| python -V | ||
| pip --version | ||
|
|
||
| - name: Set up pip cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ github.ref }}-units-VMs | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip- | ||
| ${{ runner.os }}- | ||
|
|
||
| - name: Install Ansible ${{ matrix.ansible-version }} | ||
| run: python3 -m pip install --user --force-reinstall --upgrade '${{ matrix.ansible-version }}' | ||
|
|
||
| - name: Build and install the collection tarball | ||
| run: | | ||
| export PATH=~/.local/bin:$PATH | ||
|
|
||
| echo "Run ansible version" | ||
| command -v ansible | ||
| ansible --version | ||
| rm -rf /tmp/just_new_collection | ||
| ~/.local/bin/ansible-galaxy collection build --output-path /tmp/just_new_collection --force | ||
| ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz | ||
|
|
||
| - name: Run collection tests for podman system info | ||
| run: | | ||
| export PATH=~/.local/bin:$PATH | ||
|
|
||
| export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg | ||
| if [[ '${{ matrix.ansible-version }}' == 'ansible<2.10' ]]; then | ||
| export ANSIBLE_CONFIG=$(pwd)/ci/ansible-2.9.cfg | ||
| fi | ||
|
|
||
| echo $ANSIBLE_CONFIG | ||
| command -v ansible-playbook | ||
| pip --version | ||
| python --version | ||
| ansible-playbook --version | ||
|
|
||
| ansible-playbook -vv ci/playbooks/pre.yml \ | ||
| -e host=localhost \ | ||
| -i localhost, \ | ||
| -e ansible_connection=local \ | ||
| -e setup_python=false | ||
|
|
||
| TEST2RUN=podman_system_info ./ci/run_containers_tests.sh | ||
| shell: bash |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| - hosts: all | ||
| gather_facts: true | ||
| tasks: | ||
| - include_role: | ||
| name: podman_system_info | ||
| vars: | ||
| ansible_python_interpreter: "{{ _ansible_python_interpreter }" | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,209 @@ | ||||||||
| #!/usr/bin/python | ||||||||
| # Copyright (c) 2025 Ansible Project | ||||||||
| # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||||||||
|
|
||||||||
| from __future__ import absolute_import, division, print_function | ||||||||
| __metaclass__ = type | ||||||||
|
|
||||||||
| DOCUMENTATION = r''' | ||||||||
| module: podman_system_info | ||||||||
| author: | ||||||||
| - Johnson Lien (@johnsonlien) | ||||||||
| short_description: Get podman system information from host machine | ||||||||
| description: Runs "podman system info --format json" on host machine | ||||||||
|
||||||||
| ''' | ||||||||
|
|
||||||||
| EXAMPLES = r''' | ||||||||
| - name: Get Podman system information | ||||||||
| containers.podman.podman_system_info: | ||||||||
|
|
||||||||
| - name: Get Podman system information into a variable | ||||||||
| containers.podman.podman_system_info: | ||||||||
| register: podman_info | ||||||||
| - name: Printing Podman System info | ||||||||
| debug: | ||||||||
| msg: "{{ podman_info['podman_system_info'] }} | ||||||||
|
||||||||
| msg: "{{ podman_info['podman_system_info'] }} | |
| msg: "{{ podman_info['podman_system_info'] }}" |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| version: 'conmon version 2.0.29, commit: ' | |
| version: 'conmon version 2.0.29, commit ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this breaks yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| cpu_utilization: | |
| cpu_utilization: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this breaks yaml, wrong indent
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add it in doc above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| - name: Get Podman system info | ||
| containers.podman.podman_system_info: | ||
| register: podman_info | ||
|
|
||
| - name: Check results | ||
| assert: | ||
| that: | ||
| - podman_info.podman_system_info | length > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.