community.general.chroot (8.5.0) — connection

Interact with local chroot

Authors: Maykel Moya (!UNKNOWN) <mmoya@speedyrails.com>

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Run commands or put/fetch files to an existing chroot on the Ansible controller.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Plugin requires root privileges for chroot, -E preserves your env (and location of ~/.ansible):
# sudo -E ansible-playbook ...
#
# Static inventory file
# [chroots]
# /path/to/debootstrap
# /path/to/feboostrap
# /path/to/lxc-image
# /path/to/chroot

# playbook
---
- hosts: chroots
  connection: community.general.chroot
  tasks:
    - debug:
        msg: "This is coming from chroot environment"

Inputs

    
chroot_exe:
    default: chroot
    description:
    - User specified chroot binary
    env:
    - name: ANSIBLE_CHROOT_EXE
    ini:
    - key: exe
      section: chroot_connection
    vars:
    - name: ansible_chroot_exe

executable:
    default: /bin/sh
    description:
    - User specified executable shell
    env:
    - name: ANSIBLE_EXECUTABLE
    ini:
    - key: executable
      section: defaults
    vars:
    - name: ansible_executable

remote_addr:
    default: inventory_hostname
    description:
    - The path of the chroot you want to access.
    vars:
    - name: inventory_hostname
    - name: ansible_host

disable_root_check:
    default: false
    description:
    - Do not check that the user is not root.
    env:
    - name: ANSIBLE_CHROOT_DISABLE_ROOT_CHECK
    ini:
    - key: disable_root_check
      section: chroot_connection
    type: bool
    vars:
    - name: ansible_chroot_disable_root_check
    version_added: 7.3.0
    version_added_collection: community.general