Outils pour utilisateurs

Outils du site


blog

Notes Ansible - mount - prevent nested loops

Nous voulons interdire les montages imbriqués (montage dans un montage)
Ou pour le dire autrement : Nous voulons interdire à un utilisateur de créer un point de montage dans un point de montage existant (autre que /).

playbook.yml

- name: is a nested mount ?
  become: true
  shell: |
    # will_be_mounted_on
    # Returns the mount point where the future file given in argument will be located
    set -euo pipefail
    TMP_PATH="{{ PLOP_ACCOUNT_HOME | quote }}"
    while [[ ! -e "$TMP_PATH" ]]
    do
        TMP_PATH="$(dirname $TMP_PATH)"
    done
    df -l --output=target "$TMP_PATH" | tail -1
  check_mode: false
  changed_when: false
  register: mounted_on
  when: PLOP_ACCOUNT_HOME is defined and PLOP_ACCOUNT_HOME != ''

- name: assert fail on nested mount
  assert:
    that:
      - mounted_on.stdout_lines[-1] == '/' or mounted_on.stdout_lines[-1] == PLOP_ACCOUNT_HOME
2025/03/24 15:06

Apt dpkg postinst debug

LANG=C apt-get -f install                                                                                                                                                          Err 100
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-31-generic linux-headers-3.2.0-31 linux-headers-3.2.0-27 libclamav6 linux-headers-3.2.0-27-generic libtommath0
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up grub-pc (1.99-21ubuntu3.20) ...
Killed
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 137
Errors were encountered while processing:
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)
/var/lib/dpkg/info/grub-pc.postinst
/var/lib/dpkg/info/grub-pc.postrm
/var/lib/dpkg/info/grub-pc-bin.md5sums
/var/lib/dpkg/info/grub-pc-bin.list
/var/lib/dpkg/info/grub-pc.prerm
/var/lib/dpkg/info/grub-pc.config
/var/lib/dpkg/info/grub-pc.templates
/var/lib/dpkg/info/grub-pc.conffiles
/var/lib/dpkg/info/grub-pc.preinst
/var/lib/dpkg/info/grub-pc.md5sums
/var/lib/dpkg/info/grub-pc.list

/var/lib/dpkg/info/grub-pc.postinst

#!/bin/bash -x
2025/03/24 15:06

Notes Ansible - callback plugins

ansible/plugins/callback/

ansible.cfg

[defaults]
 
# change the default callback, you can only have one 'stdout' type  enabled at a time.
#stdout_callback = skippy
stdout_callback = kafka_logger
 
# Callback pluging activated for /usr/bin/ansible too
bin_ansible_callbacks = true
 
# enable callback plugins, they can output to stdout but cannot be 'stdout' type.
#callback_whitelist = timer, mail
callback_whitelist = timer, mail
 
# callback plugin path
# cp -p /usr/lib/python3.6/site-packages/ansible/plugins/callback/timer.py ansible/plugins/callback/
callback_plugins   = $PWD/ansible/plugins/callback
ansible-doc -t callback -l
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki