community.general.git_config_info module – Read git configuration
Note
This module is part of the community.general collection (version 9.5.0).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: community.general.git_config_info
.
New in community.general 8.1.0
Synopsis
- The community.general.git_config_info module reads the git configuration by invoking
git config
.
Requirements
The below requirements are needed on the host that executes this module.
- git
Parameters
Parameter | Comments |
---|---|
name string | The name of the setting to read. If not provided, all settings will be returned as |
path path | |
scope string | Specify which scope to read values from. If set to If set to If set to If set to Choices:
|
Attributes
Attribute | Support | Description |
---|---|---|
check_mode | Support: full This action does not modify state. | Can run in |
diff_mode | Support: N/A This action does not modify state. | Will return details on what has changed (or possibly needs changing in |
Examples
- name: Read a system wide config community.general.git_config_info: name: core.editor register: result - name: Show value of core.editor ansible.builtin.debug: msg: "{{ result.config_value | default('(not set)', true) }}" - name: Read a global config from ~/.gitconfig community.general.git_config_info: name: alias.remotev scope: global - name: Read a project specific config community.general.git_config_info: name: color.ui scope: local path: /etc - name: Read all global values community.general.git_config_info: scope: global - name: Read all system wide values community.general.git_config_info: - name: Read all values of a specific file community.general.git_config_info: scope: file path: /etc/gitconfig
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
---|---|
config_value string | |
config_values dictionary | This is a dictionary mapping a git configuration setting to a list of its values. When When Returned: success Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/git_config_info_module.html