Skip to main content

coverage report pipeline status

digdeo-syspass-ansible-lookup

Module page: https://pypi.org/project/digdeo-syspass-ansible-lookup/ Bug Tracker: https://git.digdeo.fr/digdeo-system/digdeo-syspass-ansible-lookup/issues

Introduction

digdeo-syspass-ansible-lookup is an Ansible lookup plugin written in Python.

This Ansible plugin uses digdeo-syspass-client to interface with the SysPass API.

This plugin is dedicated to retrieving passwords from a SysPass server.

Installation

Normal installation

python3 -m venv venv
. venv/bin/activate
pip install digdeo-syspass-ansible-lookup

Force a specific Ansible version

python3 -m venv venv
. venv/bin/activate
pip install wheel "ansible >= 10.0"
pip install digdeo-syspass-ansible-lookup

Force libxml

On Linux (and most other well-behaved operating systems), pip will manage to build the source distribution as long as libxml2 and libxslt are properly installed, including development packages, i.e. header files, etc.

See the requirements section above and use your system package management tool to look for packages like libxml2-dev or libxslt-devel. If the build fails, make sure they are installed.

Alternatively, setting STATIC_DEPS=true will download and build both libraries automatically in their latest version, e.g.

STATIC_DEPS=true pip install lxml.

Note that module use digdeo-syspass-client python module Please pay attention about config.yml file in case you need more information's.

DISCLAIMER:
This module has been heavily inspired by https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/lookup/password.py for password generation and term handling and thus is under GPL.

lookup: syspass
author: DigDeo Team
short_description: get syspass user password and syspass API client
description:
- This lookup returns the contents from SysPass database, a user's password more specifically. Other functions are also implemented for further use.
ansible_version: ansible 10.4+ with mitogen
python_version: 3.7+
syspass_version: 3.2

Ansible usage:

Example 1

Vars set inside common ansible sub-structure directory

In case you use the group name all.

  • Create a sub directory structure ./group_vars/all and enter inside it directory
  • copy paste you variable with right value inside a file name syspass.yml
syspass_auth_token: ##################################################
syspass_token_pass: ##################################################
syspass_verify_ssl: True
syspass_api_url: ##################################################
syspass_api_version: 3.1
syspass_debug: False
syspass_debug_level: 3
syspass_verbose: True
syspass_verbose_level: 3
  • start you playbook with ansible-playbook playbook.yml

Example 2

Vars set inside the playbook file

In case you use the group name all the playbook can look like that:

--- # -*- mode: yaml; coding: utf-8 -*-

- hosts: all
  vars:
    syspass_default_length: 42
    syspass_auth_token: ##################################################
    syspass_token_pass: ##################################################
    syspass_verify_ssl: True
    syspass_api_url: ##################################################
    syspass_api_version: 3.1
    syspass_debug: False
    syspass_debug_level: 3
    syspass_verbose: True
    syspass_verbose_level: 3
  tasks:
    - name: SysPass | Force virtual Environement
      set_fact:
        ansible_python_interpreter: "/usr/bin/env python"
    - name: SysPass | Minimal test | get and if not exist insert
      debug:
        msg: "{{ lookup('syspass', 'Account Name minimal', login='mylogin', category='MySQL', customer='PREP') }}"
      register: pass1
      changed_when: false
    - name: SysPass | Minimal test | get and compare
      debug:
        msg: "{{ lookup('syspass', 'Account Name minimal', login='mylogin', category='MySQL', customer='PREP') }}"
      register: pass2
      changed_when: pass1.msg == pass2.msg
      failed_when: pass1.msg != pass2.msg

Ansible Vault usage:

In case you use the group name all.

  • Create a sub directory structure ./group_vars/all and enter inside it directory
  • use command line interface for create syspass.yml file ansible-vault create syspass.yml
  • edit the syspass.yml file ansible-vault edit syspass.yml
  • copy paste you variable with right value inside syspass.yml file
syspass_auth_token: ##################################################
syspass_token_pass: ##################################################
syspass_verify_ssl: True
syspass_api_url: ##################################################
syspass_api_version: 3.1
syspass_debug: False
syspass_debug_level: 3
syspass_verbose: True
syspass_verbose_level: 3
  • create a file to store the vault password echo "password1234" > /my_directory/vault_passwd"
  • export env var DEFAULT_VAULT_PASSWORD_FILE via export DEFAULT_VAULT_PASSWORD_FILE="/my_directory/vault_passwd"
  • start you playbook with ansible-playbook --vault-password-file=$DEFAULT_VAULT_PASSWORD_FILE playbook.yml

Summary

> cd directory_where_is_my_ansible.cfg_file
> mkdir -p group_vars/all
> cd group_vars/all
> ansible-vault create syspass.yml
New Vault password: 
Confirm New Vault password: 
> ansible-vault edit syspass.yml
Vault password:
syspass_auth_token: ##################################################
syspass_token_pass: ##################################################
syspass_verify_ssl: True
syspass_api_url: ##################################################
syspass_api_version: 3.1
syspass_debug: False
syspass_debug_level: 3
syspass_verbose: True
syspass_verbose_level: 3
~                                                                                                                                                                                         
~                                                                                                                                                                                         
~                                                                                                                                                                                         
~                                                                                                                                                                                         
-- INSERTION --    
^Z :wq
> export DEFAULT_VAULT_PASSWORD_FILE="/my_private_directory/vault_passwd"
> echo "password1234" > $DEFAULT_VAULT_PASSWORD_FILE
> cd directory_where_is_my_ansible.cfg_file
> ansible-playbook --vault-password-file=$DEFAULT_VAULT_PASSWORD_FILE playbooks/playbook.yml

Parameters:

notes:

IN PLAYBOOK

NOTE: Default values are handled

USAGE 1
    - name: SysPass | Minimal test | get and if not exist insert
      debug:
        msg: "{{ lookup('syspass', 'Account Name minimal', login='mylogin', category='MySQL', customer='PREP') }}"
      register: pass1
      changed_when: false

    - name: SysPass | Minimal test | get and compare
      debug:
        msg: "{{ lookup('syspass', 'Account Name minimal', login='mylogin', category='MySQL', customer='PREP') }}"
      register: pass2
      changed_when: pass1.msg == pass2.msg
      failed_when: pass1.msg != pass2.msg

Author: DigDeo Team

Metadata

Release files for digdeo-syspass-ansible-lookup 0.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for digdeo-syspass-ansible-lookup 0.3.8
File Size Uploaded Provenance Actions
digdeo_syspass_ansible_lookup-0.3.8.tar.gz 32.6 kB Without provenance Details for digdeo_syspass_ansible_lookup-0.3.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for digdeo-syspass-ansible-lookup 0.3.8
File Interpreter ABI Platform Actions
digdeo_syspass_ansible_lookup-0.3.8-py3-none-any.whl Python 3 none any Details for digdeo_syspass_ansible_lookup-0.3.8-py3-none-any.whl

Total release size: 62.5 kB

Release files / digdeo_syspass_ansible_lookup-0.3.8.tar.gz

Download URL digdeo_syspass_ansible_lookup-0.3.8.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6c85137c95f1c4db9d956502841c0188b75edd3ff543f724e2eac59a4f007f4c
BLAKE2b-256 checksum
How to use checksums
f7994a972c8c8c68aea02d21f44a3e5507ffd394cfb6781a5345c4d41d97c479
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / digdeo_syspass_ansible_lookup-0.3.8-py3-none-any.whl

Download URL digdeo_syspass_ansible_lookup-0.3.8-py3-none-any.whl
Size 29.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b82af86fcc0ca29f9ca8dc562059dfe8fa472dc12036ba4d7dd6953a67311b3d
BLAKE2b-256 checksum
How to use checksums
5b01f1fa04a92cd02c63358e81d8b8078f19d85384e4f3314ddb072496b2b031
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for digdeo-syspass-ansible-lookup 0.3.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page