### Plugin Content Configuration Example Source: https://github.com/normation/rudder/blob/master/relay/sources/rudder-package/SPECS.md Shows how to define the archives and their target installation paths within the plugin's metadata. ```json { "content": { "files.txz": "/opt/rudder/share", "var_rudder.txz": "/var/rudder" } } ``` -------------------------------- ### Install .NET Toolchain on Fedora Source: https://github.com/normation/rudder/blob/master/contributing/fsharp.md Example command to install the .NET toolchain using the DNF package manager on Fedora. This ensures you have the latest LTS version. ```bash sudo dnf install dotnet ``` -------------------------------- ### Install Rudder Server Source: https://github.com/normation/rudder/blob/master/README.md Use this script for a quick server installation on Linux systems. Review the script before execution for more options. ```bash curl --proto '=https' --tlsv1.2 -sSf https://repository.rudder.io/tools/rudder-setup | sh -s -- setup-server latest ``` -------------------------------- ### Install Documentation Build Tools Source: https://github.com/normation/rudder/blob/master/api-doc/README.adoc Install the necessary npm packages for building OpenAPI documentation. ```bash npm install -g redoc-cli @redocly/openapi-cli ``` -------------------------------- ### Technique Metadata Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/syntax.md This example shows the basic metadata for a technique, including its ID, name, version, description, and documentation. ```yaml id: "ntp" name: "NTP configuration" version: "1.0" description: "This technique configures the local ntp service" documentation: "**Warning**: it installs the [chrony](https://chrony.tuxfamily.org/) service." ``` -------------------------------- ### Parameter Definition Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/syntax.md This example demonstrates how to define parameters for a technique, including their names, descriptions, default values, and constraints like 'allow_empty' and 'select'. ```yaml params: - name: dns_server description: "The DNS server hostname" default: "1.1.1.1" constraints: allow_empty: true - name: ntp_server constraints: select: - value: "192.123.23.21" name: "DC1" - value: "192.123.22.21" name: "DC2" ``` -------------------------------- ### Verify Updated PATH Example Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md An example output showing the IntelliJ path successfully added to the PATH environment variable. ```bash echo $PATH /usr/local/bin/idea-IC-252.25557.131/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin ``` -------------------------------- ### RPKG Metadata Example Source: https://github.com/normation/rudder/blob/master/relay/sources/rudder-package/README.md An example of the JSON metadata file found at the start of an RPKG archive. It details plugin type, name, version, build information, dependencies, and content. ```json { "type": "plugin", "name": "rudder-plugin-dsc", "version": "8.0.3-2.5", "build-date": "2023-11-23T17:52:03+00:00", "build-commit": "bfd5b32bafa097e81a25bcb0d33a1e0a94160b7c", "depends": { "binary": [ "zip" ] }, "jar-files": [ "/opt/rudder/share/plugins/dsc/dsc.jar" ], "content": { "files.txz": "/opt/rudder/share/plugins", "agent-policy.txz": "/var/rudder/configuration-repository", "dsc-common.txz": "/var/rudder/configuration-repository/techniques/system", "techniques.txz": "/var/rudder/configuration-repository", "ncf.txz": "/var/rudder/configuration-repository", "hooks.txz": "/opt/rudder/etc" } } ``` -------------------------------- ### Install Maven Dependencies Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Installs all necessary Maven dependencies for the project. This may take several minutes. ```bash mvn clean install ``` -------------------------------- ### Example Technique Test Case YAML Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/test.md Defines a test case for a technique, specifying target platform, parameters, conditions, policy mode, setup, check, and cleanup steps. Supports 'sh' steps for command execution. ```yaml target: windows params: param1: value1 param2: true conditions: - condition1 - condition2 policy_mode: audit setup: - sh: "touch /my/file" check: # Linux target - sh: "test -f /my/file" # Windows target - sh: "if (Test-Path -Path C:\my\file) { exit 0 } else { exit 1 }" cleanup: - sh: "rm -f /my/file" ``` -------------------------------- ### Install Relayd Source: https://github.com/normation/rudder/blob/master/relay/sources/relayd/README.md Execute this command to install relayd, specifying a target directory for the installation. ```bash make DESTDIR=/target/directory install ``` -------------------------------- ### Example Rudder Nightly Version Configuration Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md A JSON configuration example for setting up Rudder with nightly build versions and specifying system details. This is useful for testing recent changes. ```json { "default": { "rudder-version": "8.3-nightly", "system": "debian12", "inventory-os": "debian" }, "server": { "rudder-setup": "server" } } ``` -------------------------------- ### Install Debian/Ubuntu Build Dependencies Source: https://github.com/normation/rudder/blob/master/relay/sources/relayd/README.md Use this command to install the necessary build dependencies on Debian or Ubuntu systems. ```bash sudo make apt-dependencies ``` -------------------------------- ### Review Rudder Setup Script Source: https://github.com/normation/rudder/blob/master/README.md Download and make the rudder-setup script executable to review its options and usage before running it. ```bash wget https://repository.rudder.io/tools/rudder-setup chmod +x rudder-setup ./rudder-setup -h ``` -------------------------------- ### Example Rudder Module Session Source: https://github.com/normation/rudder/blob/master/policies/rudder-module-type/README.md This example demonstrates a typical interaction session between `rudder-module-commands` and the CFEngine agent. It includes the initial agent version message, followed by JSON objects for `validate_promise` operations. ```bash ~commands% /opt/rudder/bin/rudder-module-commands --cfengine cf-agent 3.24.3 v1 Commands 0.0.1 v1 json_based action_policy {"filename":"/tmp/oui.fda","line_number":42,"operation":"validate_promise","log_level":"info","promise_type":"ruddercommand","promiser":"fda_test","attributes":{"node_id":"root","agent_frequency_minutes":"5","rudder_module_protocol":0,"data":{"args":"","chdir":"","command":"/bin/true /tmp/.tmpcMCLwA/target.txt","compliant_codes":"","env_vars":"","gid":"1000","in_shell":false,"output_to_file":"","repaired_codes":"0","run_in_audit_mode":false,"shell_path":"/bin/sh","show_content":true,"stdin":"","stdin_add_newline":true,"strip_output":false,"timeout":"30","uid":"1000","umask":"0022"}}} {"operation":"validate_promise","promiser":"fda_test","attributes":{"temporary_dir":"/var/rudder/tmp/","backup_dir":"/var/rudder/modified-files/","state_dir":"/var/rudder/cfengine-community/state/","node_id":"root","agent_frequency_minutes":5,"rudder_module_protocol":0,"report_id":null,"data":{"args":"","chdir":"","command":"/bin/true /tmp/.tmpcMCLwA/target.txt","compliant_codes":"","env_vars":"","gid":"1000","in_shell":false,"output_to_file":"","repaired_codes":"0","run_in_audit_mode":false,"shell_path":"/bin/sh","show_content":true,"stdin":"","stdin_add_newline":true,"strip_output":false,"timeout":"30","uid":"1000","umask":"0022"},"action_policy":"fix"},"result":"valid"} ``` -------------------------------- ### Install RHEL/Fedora Build Dependencies Source: https://github.com/normation/rudder/blob/master/relay/sources/relayd/README.md Use this command to install the necessary build dependencies on RHEL or Fedora systems. ```bash sudo make yum-dependencies ``` -------------------------------- ### Setup Virtual Machine Environment Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Command to create and prepare the virtual machine environment based on the platform description file. Ensure you are in the `rudder-tests` directory. ```bash ./rtf platform setup ``` -------------------------------- ### Install Rudder Agent Source: https://github.com/normation/rudder/blob/master/README.md Use this script for a quick agent installation on Linux systems. Replace SERVER with your Rudder server's IP or hostname. Review the script before execution for more options. ```bash curl --proto '=https' --tlsv1.2 -sSf https://repository.rudder.io/tools/rudder-setup | sh -s -- setup-agent latest SERVER ``` -------------------------------- ### Method Definition Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/syntax.md Shows how to define a method within a policy, including its name, parameters, and reporting settings. ```yaml items: - name: "Ensure telnet-server absence" tags: cve: CVE-2022-3456 condition: "debian" method: package_absent params: name: "telnet-server" reporting: mode: disabled ``` -------------------------------- ### API Versioning Example Source: https://github.com/normation/rudder/blob/master/webapp/sources/api-doc/introduction.md Illustrates how to specify the API version in either the URL or via an HTTP header. ```APIDOC ## API Versioning ### Description API versioning allows for new features to be added without breaking existing scripts. Versions are integers or `latest`. You can specify the version in the URL or via the `X-API-Version` header. ### URL Versioning Example ```bash # Version 10 curl -X GET -H "X-API-Token: yourToken" https://rudder.example.com/rudder/api/10/rules # Latest version curl -X GET -H "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/rules ``` ### Header Versioning Example ```bash # Version 10 curl -X GET -H "X-API-Token: yourToken" -H "X-API-Version: 10" https://rudder.example.com/rudder/api/rules ``` ``` -------------------------------- ### Setup Rudder GPG Keyring Source: https://github.com/normation/rudder/blob/master/relay/sources/rudder-package/tools/README.md Use these commands to remove an existing keyring, download the public key, and import it into a new keyring file. ```bash rm -f rudder_plugins_key.gpg wget https://repository.rudder.io/apt/rudder_apt_key.pub gpg --no-default-keyring --keyring ./rudder_plugins_key.gpg --import rudder_apt_key.pub ``` -------------------------------- ### Example Rudder Technique in YAML Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/introduction.md This is an example of a Rudder technique defined in YAML format. It demonstrates the structure and syntax for creating techniques programmatically. ```yaml --- title: "NTP synchronization" description: "Ensure NTP is configured and synchronized." method: - "file: path: /etc/ntp.conf content: | server 0.pool.ntp.org iburst server 1.pool.ntp.org iburst driftfile /var/lib/ntp/ntp.drift permissions: owner: root group: root mode: "0644" - "service: name: ntp enabled: true ensure: running running: true reload: true dependencies: - "file: /etc/ntp.conf" ``` -------------------------------- ### Setup Platform in Rudder Tests Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Set up a specific platform for testing within the Rudder Test framework. Replace with the desired version number. ```bash cd ~/Workspace/rudder-tests ./rtf platorm setup debian ``` -------------------------------- ### Minimalistic Platform Configuration Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md This JSON defines the most basic functional configuration for a platform description file used by `rtf setup`. It specifies the default environment settings and the server setup. ```json { "default":{ "run-with": "vagrant", "rudder-version": "6.0", "system": "debian9", "inventory-os": "debian" }, "server": { "rudder-setup": "dev-server" } } ``` -------------------------------- ### Install Rust Components Source: https://github.com/normation/rudder/blob/master/contributing/rust.md Use rustup to add essential components like rustfmt for code formatting and clippy for linting. These integrate with cargo commands. ```bash rustup component add rustfmt # to format code, use with "cargo fmt" rustup component add clippy # various linters, use with "cargo clippy" ``` -------------------------------- ### Initialize Rudder Setup with Elm Source: https://github.com/normation/rudder/blob/master/webapp/sources/rudder/rudder-web/src/main/webapp/templates-hidden/components/administration/setup.html This JavaScript code initializes the Elm application for the Rudder setup page. It waits for the DOM to be ready, then mounts the Elm app to a specific node, passing initial flags. It also sets up subscriptions to error and success notification ports from the Elm app. ```javascript $(document).ready(function () { var main = document.getElementById("setup-content") var initValues = { contextPath : contextPath }; var app = Elm.Onboarding.init({node: main, flags: initValues}); app.ports.errorNotification.subscribe(function(message) { createErrorNotification(message); }); app.ports.successNotification.subscribe(function(message) { createSuccessNotification(message); }); }) ``` -------------------------------- ### Current Logger Output Example Source: https://github.com/normation/rudder/blob/master/adr/system/28116-method-logger-no-suffix.md Demonstrates the output generated by the current logger, including the automatically appended suffix. ```plaintext Package presence was repaired ``` -------------------------------- ### Block Definition Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/syntax.md Demonstrates the structure of a block with optional tags, condition, and reporting modes. ```yaml items: - name: "Ensure telnet-server absence" tags: cve: CVE-2022-3456 condition: "debian" reporting: mode: worst-case-weighted-one items: - ... - ... ``` -------------------------------- ### API Authentication Example Source: https://github.com/normation/rudder/blob/master/webapp/sources/api-doc/introduction.md Demonstrates how to authenticate requests to the Rudder REST API using an API token in the request header. ```APIDOC ## API Authentication ### Description All requests to the Rudder REST API must be authenticated using an API token. The token is a 32-character string passed in the `X-API-Token` header. ### Method GET (example) ### Endpoint `https://rudder.example.com/rudder/api/latest/rules` ### Request Example ```bash curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/rules ``` ### System Token Usage For local calls without configuring an account, you can use the system token located at `/var/rudder/run/api-token`. To prevent leaking the token in the process list, use the alternative form: ```bash curl --header @/var/rudder/run/api-token-header ``` ``` -------------------------------- ### Add IntelliJ to PATH in .bashrc Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Example of how to add the IntelliJ binary directory to your system's PATH environment variable. ```bash export $PATH="/usr/local/bin/idea-IC-252.25557.131/bin:$PATH" ``` -------------------------------- ### Plugin Metadata Version Example Source: https://github.com/normation/rudder/blob/master/relay/sources/rudder-package/SPECS.md Illustrates the format of the 'version' field in a plugin's metadata, which combines the Rudder webapp version and the plugin version. ```json { "version": "8.0.1~rc3-2.9" } ``` -------------------------------- ### MiniJinja First Filter Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Returns the first item from an iterable. Useful for getting the first element of a list or sequence. ```minijinja {{ user.email_addresses\|first\|default('no user') }} ``` -------------------------------- ### Initialize Rudder Configuration Repository Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Copies the techniques from the cloned repository into the Rudder configuration directory and initializes a new Git repository. This sets up the structure for managing configuration changes. ```bash sudo cp -r rudder-techniques/techniques /var/rudder/configuration-repository/ git init /var/rudder/configuration-repository/ ``` -------------------------------- ### Build API Documentation Source: https://github.com/normation/rudder/blob/master/api-doc/README.adoc Execute the make command to build the API documentation. The resulting files will be located in the 'target/' directory. ```bash make ``` -------------------------------- ### Example JSON Payload Source: https://github.com/normation/rudder/blob/master/webapp/sources/api-doc/introduction.md This is an example of a valid JSON structure for API requests. Ensure strings are quoted and other types are not. ```json { "key1": "value1", "key2": false, "key3": 42 } ``` -------------------------------- ### Build technique documentation with rudderc Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/usage.md Generates documentation for your technique, which is useful for techniques using custom methods not in the public documentation. The `--open` option can be used to automatically open the documentation in a browser. ```shell $ rudderc lib Read 179 methods (/.../ncf/tree/30_generic_methods/) Book building has started Running the html backend Wrote target/doc/book/index.html ``` -------------------------------- ### MiniJinja Abs Filter Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Returns the absolute value of a number. Example shows calculating the absolute difference between 'a' and 'b'. ```minijinja \|a - b\| = {{ (a - b)\|abs }} -> \|2 - 4\| = 2 ``` -------------------------------- ### Commit Initial Techniques Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Adds and commits the techniques directory to the local Git repository. This establishes the first version of the configuration repository. ```bash git add techniques/ git commit -m "techniques first commit" ``` -------------------------------- ### Strict-Transport-Security Header Example Source: https://github.com/normation/rudder/blob/master/webapp/arch-doc/rudder-7-3-frontend-security.md This is an example of the `Strict-Transport-Security` header generated when HSTS is enabled. It specifies a max-age of one year and includes subdomains. ```bash Strict-Transport-Security # max-age = 1 year max-age=31536000 ; includeSubDomains ``` -------------------------------- ### Resource File Structure Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/syntax.md Illustrates the directory structure for including resource files within a Rudder technique. Files in the 'resources' folder are accessible via the `${resources_dir}` variable. ```bash my_technique ├── resources │ └── file1.txt ├── technique.yml └── tests ``` -------------------------------- ### Ignored Error Log Example Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md An example of an error log that can be ignored during development when running Rudder locally in development mode, due to the absence of a relay or agent. ```log [2025-10-07T15:45:31+0200] WARNING Failed to execute shell command from Rudder: error=2, No such file or directory 2025-10-07 15:45:31+0200 ERROR com.normation.rudder.services.policies.WriteNodeCertificatesPemImpl - Unexpected: Error when executing reload command '/opt/rudder/bin/rudder relay reload -p' after writing node certificates file. Command output: code: -2147483648 ``` -------------------------------- ### Install Cargo Tools Source: https://github.com/normation/rudder/blob/master/contributing/rust.md Install additional cargo-installed tools for dependency management, outdated dependency checks, and compilation caching. These are useful for maintaining project health and performance. ```bash cargo install cargo-deny # to list known vulnerabilities and check licenses in dependencies cargo install cargo-outdated # to list outdated dependencies cargo install cargo-update # to update cargo-installed tools cargo install cargo-tree # to see the tree of dependencies cargo install cargo-benchcmp # to compare benchmarks results cargo install sccache # to share compilation cache locally between projects ``` -------------------------------- ### Run Rudder Technique Tests Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/test.md Command-line examples for running Rudder technique tests. Use to run all tests or filter by a specific test case name. Requires a library path when run outside a Rudder server. ```shell # Run all defined tests rudderc test --library /path/to/lib # Run only the case1 test rudderc test --library /path/to/lib case1 ``` -------------------------------- ### Create a new technique with rudderc Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/usage.md Use this command to set up the basic file structure for a new Rudder technique. It creates a technique.yml file, a resources directory, and a tests directory. ```shell $ rudderc new my_technique Wrote ./my_technique/technique.yml $ cd my_technique ``` -------------------------------- ### Platform Configuration with Relay and Agents Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md An extended platform configuration example that includes a relay and two agents. This demonstrates how to add more components to your virtual test environment. ```json ... "relay": { "rudder-setup": "relay" }, "agent1": { "rudder-setup": "agent", "system" : "debian8", "server": "relay" }, "agent2": { "rudder-setup": "agent", "system" : "debian7" }, ... ``` -------------------------------- ### MiniJinja Capitalize Filter Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Converts the first character of a string to uppercase and the rest to lowercase. ```minijinja {{ chapter.title\|capitalize }} ``` -------------------------------- ### Export technique for Rudder server import Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/usage.md Builds the technique and exports it as a zip archive, suitable for importing into a Rudder server via the archives HTTP API. ```shell $ rudderc build --export Writing ./target/ntp_technique-0.1.zip ``` -------------------------------- ### Get Length of Value Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md The 'length' filter returns the number of items in a sequence or characters in a string. ```jinja {{ results|length }} ``` -------------------------------- ### Display rudder-dev Help Source: https://github.com/normation/rudder/blob/master/CONTRIBUTING.md Execute this command to view the available options and usage instructions for the `rudder-dev` tool. ```bash rudder-dev --help ``` -------------------------------- ### Deploy WAR and restart service on Vagrant server Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Connect to a Vagrant server, move the WAR file to the webapps directory, replace the existing rudder.war, and restart the rudder-jetty service. ```bash vagrant ssh _server sudo su mv rudder-web-8.3.5-SNAPSHOT.war /opt/rudder/share/webapps/ cd /opt/rudder/share/webapps/ mv rudder.war rudder.war.save mv rudder-web-8.3.5-SNAPSHOT.war rudder.war systemctl restart rudder-jetty ``` -------------------------------- ### Get Last Item from Iterable Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Use the 'last' filter to retrieve the final element from a sequence. ```jinja {% with update = updates|last %} ``` -------------------------------- ### Get Rules Source: https://github.com/normation/rudder/blob/master/webapp/sources/api-doc/introduction.md This endpoint retrieves a list of rules. It demonstrates how to authenticate and specify the API version. ```APIDOC ## GET /rudder/api/rules ### Description Retrieves a list of rules from the Rudder API. ### Method GET ### Endpoint https://rudder.example.com/rudder/api/rules ### Parameters #### Headers - **X-API-Token** (string) - Required - API authentication token. - **X-API-Version** (string) - Required - The API version to use (e.g., "3.14"). ``` -------------------------------- ### MiniJinja Bool Filter Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Converts a value into its boolean representation. Any non-zero number is considered true. ```minijinja {{ 42\|bool }} -> true ``` -------------------------------- ### Manually import technique to Rudder server file system Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/usage.md This process involves copying the technique's YAML file to the Rudder configuration repository, committing the changes, and then reloading the techniques on the server. This method does not support technique parameter types or display tags in the technique editor. ```shell cd /var/rudder/configuration-repository/ mkdir -p CATEGORY/MY_TECHNIQUE/1.0/ cp /path/to/technique.yml CATEGORY/MY_TECHNIQUE/1.0/ git add CATEGORY/MY_TECHNIQUE/ git commit -m "Add my technique" rudder server reload-techniques ``` -------------------------------- ### Equivalent YAML without Foreach Loop Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/syntax.md Illustrates the expanded form of the previous foreach examples, showing the equivalent YAML without using the foreach construct. This helps understand the compilation output. ```yaml items: - name: "Install the vim package" method: package_present params: name: "vim" version: "latest" - name: "Install the 'htop' package" method: package_present params: name: htop" version: "latest" ``` -------------------------------- ### MiniJinja Int Filter Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Converts a value into an integer. Compares the converted string '42' to the integer 42. ```minijinja {{ "42"\|int == 42 }} -> true ``` -------------------------------- ### Clone Rudder Techniques Repository Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Initializes the local Rudder configuration repository by cloning the official techniques repository. This provides the base set of techniques for the application. ```bash git clone https://github.com/Normation/rudder-techniques.git ``` -------------------------------- ### MiniJinja Groupby Filter Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Groups a sequence of objects by a specified attribute. Allows for iterating over grouped items. ```minijinja {% for city, items in users\|groupby("city") %} ``` -------------------------------- ### MiniJinja Dictsort Filter Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Sorts a dictionary. Options include sorting in reverse order and case sensitivity. ```minijinja {{ dict\|sort('reverse') }} ``` -------------------------------- ### Configure Apache for Debian (apache2) Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Copies the Rudder Apache configuration file to the available configurations directory and modifies it to point to the correct NCF repository path. Requires `apache2` to be installed. Restart the `apache2` service after configuration. ```bash cp /contributing/rudder.conf /etc/apache2/conf-available/ sed -i "s###" /etc/apache2/conf-available/rudder.conf service apache2 restart ``` -------------------------------- ### Length Comparison Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/augeas.md Checks the length of a node's value against a specified number using a comparison operator. ```augeas check /files/etc/hosts/1/canonical len == 9 ``` -------------------------------- ### Connect to LDAP Server Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Instructions for connecting Apache Directory Studio to the LDAP server running within the virtual machine. Requires hostname, port, Bind DN, and Bind password. ```text - Hostname : localhost - Port : 1389 ``` -------------------------------- ### Rudder Local User Configuration Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Create a `users.xml` file to define user credentials and permissions for local development. This example configures an administrator user with username 'admin' and password 'admin'. ```xml ``` -------------------------------- ### Get Unique Items from List Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md The 'unique' filter returns a list containing only the unique items from the input sequence. ```jinja {{ ['foo', 'bar', 'foobar', 'foobar']|unique|list }} -> ['foo', 'bar', 'foobar'] ``` -------------------------------- ### Create Rudder Webapp Directories Source: https://github.com/normation/rudder/blob/master/contributing/webapp.md Creates essential directories for the Rudder web application's inventory, share, logs, and runtime data. Ensure these paths are correct for your installation. ```bash mkdir -p /var/rudder/inventories/incoming \ /var/rudder/share \ /var/rudder/inventories/accepted-nodes-updates \ /var/rudder/inventories/received \ /var/rudder/inventories/failed \ /var/rudder/configuration-repository/campaigns/ \ /var/log/rudder/core \ /var/log/rudder/compliance/ \ /var/rudder/run/ touch /var/log/rudder/core/rudder-webapp.log \ /var/log/rudder/compliance/non-compliant-reports.log \ /var/rudder/run/api-token ``` -------------------------------- ### MiniJinja Float Filter Example Source: https://github.com/normation/rudder/blob/master/policies/rudderc/docs/src/modules/template.md Converts a value into a floating-point number. Compares the converted string '42.5' to the float 42.5. ```minijinja {{ "42.5"\|float == 42.5 }} -> true ```