본문 바로가기

리눅스

[Ansible] ansible-config 명령

반응형

ansible-config 명령

ansible-config -h
$ ansible-config -h
usage: ansible-config [-h] [--version] [-v] {list,dump,view,init} ...

View ansible configuration.

positional arguments:
  {list,dump,view,init}
    list                Print all config options
    dump                Dump configuration
    view                View configuration file
    init                Create initial configuration

optional arguments:
  --version             show program's version number, config file location, configured module search path, module location, executable location and exit
  -h, --help            show this help message and exit
  -v, --verbose         verbose mode (-vvv for more, -vvvv to enable connection debugging)

 

ansible-config --version
$ ansible-config --version
ansible-config [core 2.12.8]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/vagrant/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-config
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True

모든 구성 옵션 출력

ansible-config list
$ ansible-config list
ACTION_WARNINGS:
  default: true
  description:
  - By default Ansible will issue a warning when received from a task action (module
    or action plugin)
  - These warnings can be silenced by adjusting this setting to False.
  env:
  - name: ANSIBLE_ACTION_WARNINGS
  ini:
  - key: action_warnings
    section: defaults
  name: Toggle action warnings
  type: boolean
  version_added: '2.5'
...
YAML_FILENAME_EXTENSIONS:
  default:
  - .yml
  - .yaml
  - .json
  description:
  - Check all of these extensions when looking for 'variable' files which should be
    YAML or JSON or vaulted versions of these.
  - This affects vars_files, include_vars, inventory and vars plugins among others.
  env:
  - name: ANSIBLE_YAML_FILENAME_EXT
  ini:
  - key: yaml_valid_extensions
    section: defaults
  name: Valid YAML extensions
  type: list

구성 파일 보기

ansible-config view
$ ansible-config view
# Since Ansible 2.12 (core):
# To generate an example config file (a "disabled" one with all default settings, commented out):
#               $ ansible-config init --disabled > ansible.cfg
#
# Also you can now have a more complete file by including existing plugins:
# ansible-config init --disabled -t all > ansible.cfg

# For previous versions of Ansible you can check for examples in the 'stable' branches of each version
# Note that this file was always incomplete  and lagging changes to configuration settings

# for example, for 2.9: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg

덤프 구성

ansible-config dump
ansible-config dump --only-changed

초기 구성 생성

ansible-config init --disabled > ansible.cfg

ansible config(ansible.cfg) 우선 순위

- ANSIBLE_CONFIG (environment variable if set)

- ansible.cfg (in the current directory)

- ~/.ansible.cfg (in the home directory)

/etc/ansible/ansible.cfg

 

참고URL

- https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html

 

728x90
반응형