Ansible-Navigator Konfigurasjon

Ansible-Navigator Konfigurasjon


Vi kan lage en egen konfigurasjonsfil for Ansible Navigator hvis vi ikke ønsker å bruke standard.
Konfigurasjonsfilen heter ansible.cfg og ligger i ~/.config/ansible-navigator/

Lokasjons av konfigurasjonsfilene:

1. ANSIBLE_NAVIGATOR_CONFIG environment variable
export ANSIBLE_NAVIGATOR_CONFIG=/path/to/ansible-navigator.yml

2. ansible-navigator.yml fil i prosjekt mappen du kjører ansible-navigator fra

3. ~/.ansible-navigator.yml fil i hjemmemappen

Du kan ha ansible_navigator filen i yaml, yml eller json format.

Generere en konfigurasjonsfilene:
Du kan bruke ansible-navigator settings kommandoen for å generere en konfigurasjonsfil.
Ved å bruke --sample får du en konfigurasjon fil i YAML format.
Når du oppretter en konfigurasjonsfil så kan du ikke gi den navnet ansible-navigator.yml

Eksempel:
ansible-navigator settings --sample > ansible-navigator-sample.yml

---
ansible-navigator:
#   ansible:
#     config:
#       # Help options for ansible-config command in stdout mode
#       help: False
#       # Specify the path to the ansible configuration file
#       path: ./ansible.cfg
#     # Extra parameters passed to the underlying ansible command (e.g.
#     # ansible-playbook, ansible-doc, etc)
#     cmdline: "--forks 15"
#     doc:
#       # Help options for ansible-doc command in stdout mode
#       help: False
#       plugin:
#         # Specify the plugin name
#         name: debug
#         # Specify the plugin type, 'become', 'cache', 'callback', 'cliconf',
#         # 'connection', 'filter', 'httpapi', 'inventory', 'keyword', 'lookup',
#         # 'module', 'netconf', 'role', 'shell', 'strategy', 'test' or 'vars'
#         type: module
#     inventory:
#       # Help options for ansible-inventory command in stdout mode
#       help: True
#       # Specify an inventory file path or comma separated host list
#       entries:
#         - host1,
#         - router1,router2
#         - inventory.yml
#     playbook:
#       # Help options for ansible-playbook command in stdout mode
#       help: False
#       # Specify the playbook name
#       path: site.yml
#   ansible-builder:
#     # Help options for ansible-builder command in stdout mode
#     help: False
#     # Specify the path that contains ansible-builder manifest files
#     workdir: /tmp/
#   ansible-lint:
#     # Specify the path to the ansible-lint configuration file
#     config: ~/lint-config.yml
#     # Path to files on which to run ansible-lint
#     lintables: ~/myproject/
#   ansible-runner:
#     # The directory path to store artifacts generated by ansible-runner
#     artifact-dir: ./runner-artifacts
#     # Keep ansible-runner artifact directories, for last n runs, if set to 0
#     # artifact directories won't be deleted
#     rotate-artifacts-count: 10
#     # The timeout value after which ansible-runner will forcefully stop the
#     # execution
#     timeout: 300
#     # Write ansible-runner job_events in the artifact directory
#     job-events: True
#   # Subcommands
#   app: welcome
#   # The path to collection doc cache
#   collection-doc-cache-path: $HOME/.cache/ansible-navigator/collection_doc_cache.db
#   color:
#     # Enable the use of color for mode interactive and stdout
#     enable: True
#     # Enable or disable terminal color changing support with OSC 4
#     osc4: True
#   editor:
#     # Specify the editor command
#     command: vim_from_setting
#     # Specify if the editor is console based
#     console: False
#   # Enable prompts for password and in playbooks. This will set mode to
#   # stdout and disable playbook artifact creation
#   enable-prompts: False
#   exec:
#     # Specify the exec command should be run in a shell
#     shell: True
#     # Specify the command to run within the execution environment
#     command: /bin/bash
#   execution-environment:
#     # Specify the container engine (auto=podman then docker)
#     container-engine: auto
#     # Extra parameters passed to the container engine command
#     container-options:
#       - "--net=host"
#     # Enable or disable the use of an execution environment
#     enabled: True
#     environment-variables:
#       # Specify an existing environment variable to be passed through to and
#       # set within the execution environment (--penv MY_VAR)
#       pass:
#         - ONE
#         - TWO
#         - THREE
#       # Specify an environment variable and a value to be set within the
#       # execution environment (--senv MY_VAR=42)
#       set:
#         KEY1: VALUE1
#         KEY2: VALUE2
#         KEY3: VALUE3
#     # Specify the name of the execution environment image
#     image: quay.io/organization/custom-ee:latest
#     pull:
#       # Specify any additional parameters that should be added to the pull
#       # command when pulling an execution environment from a container
#       # registry. e.g. --pa='--tls-verify=false'
#       arguments:
#         - "--tls-verify=false"
#       # Specify the image pull policy always:Always pull the image,
#       # missing:Pull if not locally available, never:Never pull the image,
#       # tag:if the image tag is 'latest', always pull the image, otherwise
#       # pull if not locally available
#       policy: tag
#     # Specify volume to be bind mounted within an execution environment
#     # (--eev /home/user/test:/home/user/test:Z)
#     volume-mounts:
#       - src: "/tmp/directory"
#         dest: "/tmp/directory"
#         options: "Z"
#   # Specify the format for stdout output.
#   format: json
#   images:
#     # Provide detailed information about the selected execution environment
#     # image
#     details:
#       - ansible_collections
#       - ansible_version
#   # Specify a host attribute to show in the inventory view
#   inventory-columns:
#     - ansible_network_os
#     - ansible_network_cli_ssh_type
#     - ansible_connection
  logging:
#     # Specify the ansible-navigator log level
    level: debug
#     # Specify if log messages should be appended to an existing log file,
#     # otherwise a new log file will be created per session
    append: False
#     # Specify the full path for the ansible-navigator log file
#     file: $PWD/ansible-navigator.log
#   # Specify the user-interface mode
#   mode: interactive
#   playbook-artifact:
#     # Enable or disable the creation of artifacts for completed playbooks.
#     # Note: not compatible with '--mode stdout' when playbooks require user
#     # input
#     enable: True
#     # Specify the path for the playbook artifact to replay
#     replay: /tmp/test_artifact.json
#     # Specify the name for artifacts created from completed playbooks. The
#     # following placeholders are available: {playbook_dir}, {playbook_name},
#     # {playbook_status}, and {time_stamp}
#     save-as: "{playbook_dir}/{playbook_name}-artifact-{time_stamp}.json"
#   settings:
#     # Show the effective settings. Defaults, CLI parameters, environment
#     # variables, and the settings file will be combined
#     effective: False
#     # Generate a sample settings file
#     sample: False
#     # Generate a schema for the settings file ('json'= draft-07 JSON Schema)
#     schema: json
#     # Show the source of each current settings entry
#     sources: False
#   # Specify the IANA time zone to use or 'local' to use the system time
#   # zone
#   time-zone: UTC
                

Et annet alternativ er å bruke --effective for å se hvilke innstillinger som er satt.
ansible-navigator settings --effective> ansible-navigator-effective.yml
                           
---
ansible-navigator:
  ansible:
    config:
      help: false
    doc:
      help: false
      plugin:
        type: module
    inventory:
      help: false
    playbook:
      help: false
  ansible-builder:
    help: false
    workdir: /home/autom8/git_ansible_navigator/ansible_naviagtor
  ansible-runner:
    job-events: false
  app: settings
  collection-doc-cache-path: /home/autom8/.cache/ansible-navigator/collection_doc_cache.db
  color:
    enable: true
    osc4: true
  editor:
    command: vi +{line_number} {filename}
    console: true
  enable-prompts: false
  exec:
    command: /bin/bash
    shell: true
  execution-environment:
    container-engine: podman
    enabled: true
    image: ghcr.io/ansible/creator-ee:v0.22.0
    pull:
      policy: tag
  format: yaml
  images:
    details:
    - everything
  logging:
    append: true
    file: /home/autom8/git_ansible_navigator/ansible_naviagtor/ansible-navigator.log
    level: warning
  mode: stdout
  playbook-artifact:
    enable: true
    save-as: '{playbook_dir}/{playbook_name}-artifact-{time_stamp}.json'
  settings:
    effective: true
    sample: false
    schema: json
    sources: false
  time-zone: UTC
                 


Jeg kopierer ansible-navigator-effective.yml filen til ansible-navigator.yml
cp ansible-navigator-effective.yml ansible-navigator.yml
Jeg kommer til å bruke ansible-navigator.yml filen utover bloggen og editere feltene.
Jeg kommer da bare til å la de feltene som jeg har endret stå i filen.