fix: user-data-ansible can set a personalise source

This commit is contained in:
egarette@silique.fr 2026-02-11 21:31:55 +01:00
parent a4fefee09d
commit eb0f5901ab
8 changed files with 107 additions and 43 deletions

23
README.fr.md Normal file
View file

@ -0,0 +1,23 @@
---
gitea: none
include_toc: true
---
[🇬🇧 (EN)](README.md) - [🇫🇷 (FR)](README.fr.md)
===============
{}
## Charge les données utilisateur depuis un fichier compatible avec Ansible
> [!NOTE]
>
> **Chemin** : ansible\
> *`désactivé`*\
> **Désactivé** : si ansible n'est pas définit dans "[Sélection pour données utilisateur](#step.user_data)"
| Variable | Description | Valeur par défaut | Type | Contrôle des accès | Validateur |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|---------------------|--------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| **<a id="ansible.filename" name="ansible.filename">ansible.filename</a>**<br/>**Ligne de commande** : <br/>--ansible.filename<br/>**Variable d'environnement** : ANSIBLE.FILENAME | Nom du fichier d&#x27;inventaire Ansible. | | [`UNIX filename`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `obligatoire` | *`désactivé`*<br/>**Désactivé** : si ansible n'est pas définit dans "[Sélection pour données utilisateur](#step.user_data)" | `unique`<br/>&nbsp;le nom de fichier peut être une chemin relatif<br/>&nbsp;le fichier doit exister<br/>&nbsp;type de fichier autorisé: "file". |
| **<a id="ansible.secret" name="ansible.secret">ansible.secret</a>**<br/>**Ligne de commande** : <br/>--ansible.secret<br/>**Variable d'environnement** : ANSIBLE.SECRET | Secret pour déchiffrer le fichier. | | [`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | *`désactivé`*<br/>**Désactivé** : si ansible n'est pas définit dans "[Sélection pour données utilisateur](#step.user_data)" | |
| **<a id="ansible.file_with_secrets" name="ansible.file_with_secrets">ansible.file_with_secrets</a>**<br/>**Ligne de commande** : <br/>--ansible.file_with_secrets<br/>**Variable d'environnement** : ANSIBLE.FILE_WITH_SECRETS | Les fichiers Ansible qui peuvent contenir des secrets. | all | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `obligatoire` | *`désactivé`*<br/>**Désactivé** : si ansible n'est pas définit dans "[Sélection pour données utilisateur](#step.user_data)" | **Choix** : <br/>&nbsp;all<br/>&nbsp;first<br/>&nbsp;last<br/>&nbsp;none |

View file

@ -1,2 +1,23 @@
# rougail-user-data-ansible ---
gitea: none
include_toc: true
---
[🇬🇧 (EN)](README.md) - [🇫🇷 (FR)](README.fr.md)
===============
{}
## Load user data from Ansible compatible file
> [!NOTE]
>
> **Path**: ansible\
> *`disabled`*\
> **Disabled**: if ansible is not set in "[Select for user datas](#step.user_data)"
| Variable | Description | Default value | Type | Access control | Validator |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|-----------------|------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| **<a id="ansible.filename" name="ansible.filename">ansible.filename</a>**<br/>**Command line**: <br/>--ansible.filename<br/>**Environment variable**: ANSIBLE.FILENAME | Ansible filename inventory. | | [`UNIX filename`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `mandatory` | *`disabled`*<br/>**Disabled**: if ansible is not set in "[Select for user datas](#step.user_data)" | `unique`<br/>&nbsp;this filename could be a relative path<br/>&nbsp;this file must exist<br/>&nbsp;file type allowed: "file". |
| **<a id="ansible.secret" name="ansible.secret">ansible.secret</a>**<br/>**Command line**: <br/>--ansible.secret<br/>**Environment variable**: ANSIBLE.SECRET | Secret to decrypt file. | | [`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | *`disabled`*<br/>**Disabled**: if ansible is not set in "[Select for user datas](#step.user_data)" | |
| **<a id="ansible.file_with_secrets" name="ansible.file_with_secrets">ansible.file_with_secrets</a>**<br/>**Command line**: <br/>--ansible.file_with_secrets<br/>**Environment variable**: ANSIBLE.FILE_WITH_SECRETS | Ansible files that may contain secrets. | all | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | *`disabled`*<br/>**Disabled**: if ansible is not set in "[Select for user datas](#step.user_data)" | **Choices**: <br/>&nbsp;all<br/>&nbsp;first<br/>&nbsp;last<br/>&nbsp;none |

View file

@ -5,8 +5,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"POT-Creation-Date: 2025-02-10 09:15+0100\n" "POT-Creation-Date: 2026-02-11 21:30+0100\n"
"PO-Revision-Date: 2025-02-10 09:15+0100\n" "PO-Revision-Date: 2026-02-11 21:31+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr\n" "Language: fr\n"
@ -14,26 +14,38 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.5\n" "X-Generator: Poedit 3.8\n"
#: src/rougail/user_data_ansible/__init__.py:47 #: src/rougail/user_data_ansible/__init__.py:48
msgid "ansible is not set in step.user_data" msgid "ansible is not set in step.user_data"
msgstr "ansible n'est pas définit dans step.user_data" msgstr "ansible n'est pas définit dans step.user_data"
#: src/rougail/user_data_ansible/config.py:30 #: src/rougail/user_data_ansible/__init__.py:56
msgid "Configuration of user data Ansible" msgid "the Ansible file \"{0}\""
msgstr "Configuration des données utilisateurs Ansible" msgstr "le ficher Ansible \"{0}\""
#: src/rougail/user_data_ansible/config.py:39 #: src/rougail/user_data_ansible/config.py:30
msgid "Load user data from Ansible compatible file"
msgstr "Charge les données utilisateur depuis un fichier compatible avec Ansible"
#: src/rougail/user_data_ansible/config.py:35
#: src/rougail/user_data_ansible/config.py:50
#: src/rougail/user_data_ansible/config.py:59
#: src/rougail/user_data_ansible/config.py:73
msgid "if ansible is not set in \"step.user_data\""
msgstr "si ansible n'est pas définit dans \"step.user_data\""
#: src/rougail/user_data_ansible/config.py:38
msgid "Ansible filename inventory" msgid "Ansible filename inventory"
msgstr "Nom du fichier d'inventaire Ansible" msgstr "Nom du fichier d'inventaire Ansible"
#: src/rougail/user_data_ansible/config.py:55 #: src/rougail/user_data_ansible/config.py:53
msgid "Secret to decrypt file" msgid "Secret to decrypt file"
msgstr "Secret pour déchiffrer le fichier" msgstr "Secret pour déchiffrer le fichier"
#: src/rougail/user_data_ansible/config.py:65 #: src/rougail/user_data_ansible/config.py:62
#, fuzzy msgid "Ansible files that may contain secrets"
#| msgid "Ansible file that may contain passwords" msgstr "Les fichiers Ansible qui peuvent contenir des secrets"
msgid "Ansible file that may contain secrets"
msgstr "Fichier Ansible qui peuvent contenir des secrets" #~ msgid "Configuration of user data Ansible"
#~ msgstr "Configuration des données utilisateurs Ansible"

View file

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-10-10 08:05+0200\n" "POT-Creation-Date: 2026-02-11 21:31+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -19,19 +19,30 @@ msgstr ""
msgid "ansible is not set in step.user_data" msgid "ansible is not set in step.user_data"
msgstr "" msgstr ""
#: src/rougail/user_data_ansible/config.py:30 #: src/rougail/user_data_ansible/__init__.py:56
msgid "Configuration of user data Ansible" msgid "the Ansible file \"{0}\""
msgstr "" msgstr ""
#: src/rougail/user_data_ansible/config.py:39 #: src/rougail/user_data_ansible/config.py:30
msgid "Load user data from Ansible compatible file"
msgstr ""
#: src/rougail/user_data_ansible/config.py:35
#: src/rougail/user_data_ansible/config.py:50
#: src/rougail/user_data_ansible/config.py:59
#: src/rougail/user_data_ansible/config.py:73
msgid "if ansible is not set in \"step.user_data\""
msgstr ""
#: src/rougail/user_data_ansible/config.py:38
msgid "Ansible filename inventory" msgid "Ansible filename inventory"
msgstr "" msgstr ""
#: src/rougail/user_data_ansible/config.py:55 #: src/rougail/user_data_ansible/config.py:53
msgid "Secret to decrypt file" msgid "Secret to decrypt file"
msgstr "" msgstr ""
#: src/rougail/user_data_ansible/config.py:65 #: src/rougail/user_data_ansible/config.py:62
msgid "Ansible file that may contain secrets" msgid "Ansible files that may contain secrets"
msgstr "" msgstr ""

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2024-2025 Copyright (C) 2024-2026
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the
@ -53,6 +53,7 @@ class RougailUserDataAnsible(RougailUserDataYaml):
self.config = config self.config = config
self.errors = [] self.errors = []
self.warnings = [] self.warnings = []
self.source = _('the Ansible file "{0}"')
def open(self, filename: str) -> dict: def open(self, filename: str) -> dict:
"""Open file """Open file

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2024-2025 Copyright (C) 2024-2026
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the
@ -27,13 +27,12 @@ def get_rougail_config(
# or create a new only only for user data # or create a new only only for user data
options = f""" options = f"""
ansible: ansible:
description: {_("Configuration of user data Ansible")} description: {_("Load user data from Ansible compatible file")}
disabled: disabled:
type: jinja
jinja: | jinja: |
{{% if step.user_data is propertyerror or 'ansible' not in step.user_data %}} {{{{ _.step.user_data is propertyerror or 'ansible' not in _.step.user_data }}}}
disabled return_type: boolean
{{% endif %}} description: {_('if ansible is not set in "step.user_data"')}
filename: filename:
description: {_("Ansible filename inventory")} description: {_("Ansible filename inventory")}
@ -45,24 +44,22 @@ ansible:
types: types:
- file - file
disabled: disabled:
type: jinja
jinja: | jinja: |
{{% if step.user_data is propertyerror or 'ansible' not in step.user_data %}} {{{{ _.step.user_data is propertyerror or 'ansible' not in _.step.user_data }}}}
disabled return_type: boolean
{{% endif %}} description: {_('if ansible is not set in "step.user_data"')}
secret: secret:
description: {_("Secret to decrypt file")} description: {_("Secret to decrypt file")}
type: secret type: secret
disabled: disabled:
type: jinja
jinja: | jinja: |
{{% if step.user_data is propertyerror or 'ansible' not in step.user_data %}} {{{{ _.step.user_data is propertyerror or 'ansible' not in _.step.user_data }}}}
disabled return_type: boolean
{{% endif %}} description: {_('if ansible is not set in "step.user_data"')}
file_with_secrets: file_with_secrets:
description: {_("Ansible file that may contain secrets")} description: {_("Ansible files that may contain secrets")}
default: all default: all
choices: choices:
- all - all
@ -70,11 +67,10 @@ ansible:
- last - last
- none - none
disabled: disabled:
type: jinja
jinja: | jinja: |
{{% if step.user_data is propertyerror or 'ansible' not in step.user_data %}} {{{{ _.step.user_data is propertyerror or 'ansible' not in _.step.user_data }}}}
disabled return_type: boolean
{{% endif %}} description: {_('if ansible is not set in "step.user_data"')}
""" """
return { return {
"name": "ansible", "name": "ansible",

View file

@ -1,6 +1,6 @@
"""Internationalisation utilities """Internationalisation utilities
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2024-2025 Copyright (C) 2024-2026
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the