HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //proc/self/root/usr/lib/python3.9/site-packages/ansible/modules/__pycache__/debconf.cpython-39.pyc
a

�)g4�@sfddlmZmZmZeZdZdZdZddl	m
Z
ddlmZdd�Z
d	d
�Zdd�Zed
krbe�dS)�)�absolute_import�division�print_functiona�
---
module: debconf
short_description: Configure a .deb package
description:
     - Configure a .deb package using debconf-set-selections.
     - Or just query existing selections.
version_added: "1.6"
extends_documentation_fragment:
- action_common_attributes
attributes:
    check_mode:
        support: full
    diff_mode:
        support: full
    platform:
        support: full
        platforms: debian
notes:
    - This module requires the command line debconf tools.
    - A number of questions have to be answered (depending on the package).
      Use 'debconf-show <package>' on any Debian or derivative with the package
      installed to see questions/settings available.
    - Some distros will always record tasks involving the setting of passwords as changed. This is due to debconf-get-selections masking passwords.
    - It is highly recommended to add I(no_log=True) to task while handling sensitive information using this module.
    - The debconf module does not reconfigure packages, it just updates the debconf database.
      An additional step is needed (typically with I(notify) if debconf makes a change)
      to reconfigure the package and apply the changes.
      debconf is extensively used for pre-seeding configuration prior to installation
      rather than modifying configurations.
      So, while dpkg-reconfigure does use debconf data, it is not always authoritative
      and you may need to check how your package is handled.
    - Also note dpkg-reconfigure is a 3-phase process. It invokes the
      control scripts from the C(/var/lib/dpkg/info) directory with the
      C(<package>.prerm  reconfigure <version>),
      C(<package>.config reconfigure <version>) and C(<package>.postinst control <version>) arguments.
    - The main issue is that the C(<package>.config reconfigure) step for many packages
      will first reset the debconf database (overriding changes made by this module) by
      checking the on-disk configuration. If this is the case for your package then
      dpkg-reconfigure will effectively ignore changes  made by debconf.
    - However as dpkg-reconfigure only executes the C(<package>.config) step if the file
      exists, it is possible to rename it to C(/var/lib/dpkg/info/<package>.config.ignore)
      before executing C(dpkg-reconfigure -f noninteractive <package>) and then restore it.
      This seems to be compliant with Debian policy for the .config file.
requirements:
- debconf
- debconf-utils
options:
  name:
    description:
      - Name of package to configure.
    type: str
    required: true
    aliases: [ pkg ]
  question:
    description:
      - A debconf configuration setting.
    type: str
    aliases: [ selection, setting ]
  vtype:
    description:
      - The type of the value supplied.
      - It is highly recommended to add I(no_log=True) to task while specifying I(vtype=password).
      - C(seen) was added in Ansible 2.2.
    type: str
    choices: [ boolean, error, multiselect, note, password, seen, select, string, text, title ]
  value:
    description:
      -  Value to set the configuration to.
    type: str
    aliases: [ answer ]
  unseen:
    description:
      - Do not set 'seen' flag when pre-seeding.
    type: bool
    default: false
author:
- Brian Coca (@bcoca)
az
- name: Set default locale to fr_FR.UTF-8
  ansible.builtin.debconf:
    name: locales
    question: locales/default_environment_locale
    value: fr_FR.UTF-8
    vtype: select

- name: Set to generate locales
  ansible.builtin.debconf:
    name: locales
    question: locales/locales_to_be_generated
    value: en_US.UTF-8 UTF-8, fr_FR.UTF-8 UTF-8
    vtype: multiselect

- name: Accept oracle license
  ansible.builtin.debconf:
    name: oracle-java7-installer
    question: shared/accepted-oracle-license-v1-1
    value: 'true'
    vtype: select

- name: Specifying package you can register/return the list of questions and current values
  ansible.builtin.debconf:
    name: tzdata

- name: Pre-configure tripwire site passphrase
  ansible.builtin.debconf:
    name: tripwire
    question: tripwire/site-passphrase
    value: "{{ site_passphrase }}"
    vtype: password
  no_log: True
�#)�to_text)�
AnsibleModulec
Csv|�dd�|g}|�d�|��\}}}|dkr:|j|d�i}|��D]*}|�dd�\}}	|	��||�d���<qF|S)	Nzdebconf-showT� r��msg�:��*)�get_bin_path�run_command�join�	fail_json�
splitlines�split�strip)
�module�pkg�cmd�rc�out�errZ
selections�line�key�value�r�;/usr/lib/python3.9/site-packages/ansible/modules/debconf.py�get_selections�sr c	Csb|�dd�}|g}|r |�d�|dkrB|dkr6d}n|dkrBd}d	�||||g�}|j||d
�S)Nzdebconf-set-selectionsTz-u�boolean�True�true�FalseZfalser)�data)r�appendrr)	rr�question�vtyper�unseenZsetselrr%rrr�
set_selection�s
r*c
Cs�tttdddgd�tdddgd�tdgd�d	�tdd
gd�tddd
�d�gd�fdd�}|jd}|jd}|jd}|jd}|jd}t||�}d}d}|du�r
|dus�|dur�|jdd�||vr�d}n:||}	|dkr�t|���}t||���}	||	k�r
d}|�r�|j�sBt||||||�\}
}}|
�rB|j|d�||i}||v�rb|||i}nd||<|j	�r�|�
�}
|
�|�||
d�}ni}|j|||||d�|j|||d�dS)N�strTr)�type�required�aliasesZ	selectionZsetting)r,r.)
r!�errorZmultiselectZnote�password�seenZselect�string�text�title)r,�choicesZanswer�boolF)r,�default)�namer'r(rr))r'r(r)Z
argument_specZrequired_togetherZsupports_check_moder8r'r(rr)�zAwhen supplying a question you must supply a valid vtype and valuer	r!)�before�after)�changedr
�currentZprevious�diff)r<r
r=)
r�dict�paramsr rr�lowerZ
check_moder*Z_diff�copy�updateZ	exit_json)rrr'r(rr)�prevr<r
�existingr�eZcurrr;Z	diff_dictrrr�main�s\
��









rG�__main__N)Z
__future__rrrr,Z
__metaclass__Z
DOCUMENTATIONZEXAMPLESZRETURNZansible.module_utils._textrZansible.module_utils.basicrr r*rG�__name__rrrr�<module>sP#C