Skip to content

Instantly share code, notes, and snippets.

@cdot65
Last active September 16, 2022 14:22
Show Gist options
  • Save cdot65/cc7058a8a2e0585aa7bd5c1d7d550b6a to your computer and use it in GitHub Desktop.
Save cdot65/cc7058a8a2e0585aa7bd5c1d7d550b6a to your computer and use it in GitHub Desktop.
Ansible playbook to print installed Python packages
---
#------------------------------------------------------------------------
# Print out installed packages within virtual environment
#------------------------------------------------------------------------
- hosts: localhost
connection: local
tasks:
- name: create list of Python packages installed
ansible.builtin.shell: pip freeze
register: results
- name: Print Installed Python Packages
debug:
msg: "{{ results }}"
- name: create output of Ansible configuration
ansible.builtin.shell: ansible --version
register: results
- name: Print Ansible configuration
debug:
msg: "{{ results }}"
- name: create output of Ansible Galaxy configuration
ansible.builtin.shell: ansible-galaxy --version
register: results
- name: Print Galaxy configuration
debug:
msg: "{{ results }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment