feat: add new parameter ansible.file_with_secrets

This commit is contained in:
egarette@silique.fr 2025-02-10 09:17:59 +01:00
parent 03af28c835
commit 6d2bc9592b
6 changed files with 63 additions and 18 deletions

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2024-11-27 16:19+0100\n"
"PO-Revision-Date: 2024-11-27 16:21+0100\n"
"POT-Creation-Date: 2025-02-10 09:15+0100\n"
"PO-Revision-Date: 2025-02-10 09:15+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -16,6 +16,24 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.5\n"
#: src/rougail/user_data_ansible/__init__.py:46
#: src/rougail/user_data_ansible/__init__.py:47
msgid "ansible is not set in step.user_data"
msgstr "ansible n'est pas définit dans step.user_data"
#: src/rougail/user_data_ansible/config.py:30
msgid "Configuration of user data Ansible"
msgstr "Configuration des données utilisateurs Ansible"
#: src/rougail/user_data_ansible/config.py:39
msgid "Ansible filename inventory"
msgstr "Nom du fichier d'inventaire Ansible"
#: src/rougail/user_data_ansible/config.py:55
msgid "Secret to decrypt file"
msgstr "Secret pour déchiffrer le fichier"
#: src/rougail/user_data_ansible/config.py:65
#, fuzzy
#| msgid "Ansible file that may contain passwords"
msgid "Ansible file that may contain secrets"
msgstr "Fichier Ansible qui peuvent contenir des secrets"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-11-27 16:21+0100\n"
"POT-Creation-Date: 2025-02-10 09:16+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -15,7 +15,23 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n"
#: src/rougail/user_data_ansible/__init__.py:46
#: src/rougail/user_data_ansible/__init__.py:47
msgid "ansible is not set in step.user_data"
msgstr ""
#: src/rougail/user_data_ansible/config.py:30
msgid "Configuration of user data Ansible"
msgstr ""
#: src/rougail/user_data_ansible/config.py:39
msgid "Ansible filename inventory"
msgstr ""
#: src/rougail/user_data_ansible/config.py:55
msgid "Secret to decrypt file"
msgstr ""
#: src/rougail/user_data_ansible/config.py:65
msgid "Ansible file that may contain secrets"
msgstr ""

View file

@ -1,6 +1,6 @@
"""
Silique (https://www.silique.fr)
Copyright (C) 2024
Copyright (C) 2024-2025
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
@ -48,6 +48,7 @@ class RougailUserDataAnsible(RougailUserDataYaml):
self.rougailconfig = rougailconfig
self.filenames = self.rougailconfig["ansible.filename"]
self.secret = self.rougailconfig["ansible.secret"]
self.file_with_secrets = self.rougailconfig["ansible.file_with_secrets"]
self.config = config
self.errors = []
self.warnings = []

View file

@ -1,6 +1,6 @@
"""
Silique (https://www.silique.fr)
Copyright (C) 2024
Copyright (C) 2024-2025
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
@ -15,6 +15,7 @@ details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from .i18n import _
def get_rougail_config(
@ -24,18 +25,18 @@ def get_rougail_config(
"""get rougail config for ansible"""
# redefine ansible family if already exists (for output)
# or create a new only only for user data
options = """
options = f"""
ansible:
description: Configuration of user data Ansible
description: {_("Configuration of user data Ansible")}
disabled:
type: jinja
jinja: |
{% if 'ansible' not in step.user_data %}
{{% if 'ansible' not in step.user_data %}}
disabled
{% endif %}
{{% endif %}}
filename:
description: Ansible filename inventory
description: {_("Ansible filename inventory")}
type: unix_filename
multi: true
params:
@ -46,19 +47,28 @@ ansible:
disabled:
type: jinja
jinja: |
{% if 'ansible' not in step.user_data %}
{{% if 'ansible' not in step.user_data %}}
disabled
{% endif %}
{{% endif %}}
secret:
description: Secret to decrypt file
description: {_("Secret to decrypt file")}
type: secret
disabled:
type: jinja
jinja: |
{% if 'ansible' not in step.user_data %}
{{% if 'ansible' not in step.user_data %}}
disabled
{% endif %}
{{% endif %}}
file_with_secrets:
description: {_("Ansible file that may contain secrets")}
default: all
choices:
- all
- first
- last
- none
"""
return {
"name": "ansible",

View file

@ -1,6 +1,6 @@
"""Internationalisation utilities
Silique (https://www.silique.fr)
Copyright (C) 2024
Copyright (C) 2024-2025
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