passbolt / lab-passbolt-ansible-collection

Source repository for https://galaxy.ansible.com/anatomicjc/passbolt
MIT No Attribution
9 stars 10 forks source link

Error on simple playbook : Expecting value: line 1 column 1 (char 0). Expecting value: line 1 column 1 (char 0) #19

Closed RomyxBaps closed 3 months ago

RomyxBaps commented 3 months ago

Hello,

I have this error on my playbook :

TASK [Passbolt lookup plugin / fetch one] ********************************************************************************************************************
fatal: [server -> localhost]: FAILED! => 
  msg: 'An unhandled exception occurred while running the lookup plugin ''anatomicjc.passbolt.passbolt''. Error was a <class ''json.decoder.JSONDecodeError''>, original message: Expecting value: line 1 column 1 (char 0). Expecting value: line 1 column 1 (char 0)'

Here is my code :

- hosts: all
  gather_facts: false
  environment:
    PASSBOLT_BASE_URL: "http://vault.test.fr"
    PASSBOLT_VERIFY: false
    PASSBOLT_CREATE_NEW_RESOURCE: true
    PASSBOLT_PRIVATE_KEY: "mygpgkey"
    PASSBOLT_PASSPHRASE: "foobar"

  tasks:
    - name: "Passbolt lookup plugin / fetch one"
      delegate_to: localhost
      become: false
      ansible.builtin.debug:
        var: item
      loop:
        - "{{ lookup('anatomicjc.passbolt.passbolt', 'Test') }}"
      changed_when: true

    - name: "Passbolt lookup plugin / fetch one"
      delegate_to: localhost
      become: false
      ansible.builtin.debug:
        var: lookup(anatomicjc.passbolt.passbolt, 'test2', paswword='test1324*')
      changed_when: true

I don't know where is my mistake ? I think i configure everything like it needs to be.

Plugin version : anatomicjc.passbolt 0.0.14 passbolt 1.24 py-passbolt 0.0.18

Regards,

RomyxBaps commented 3 months ago

Hello,

I change my playbook to use the ansible-vault, i think the problem comes from the last newline of the gpg key after the sed command or maybe the passphrase ?

Now I have this error :

fatal: [server -> localhost]: FAILED! => 
  msg: 'An unhandled exception occurred while running the lookup plugin ''anatomicjc.passbolt.passbolt''. Error was a <class ''ValueError''>, original message: Expected: ASCII-armored PGP data. Expected: ASCII-armored PGP data'

i don't know what is the problem...

RomyxBaps commented 3 months ago

Hello, All those things comes from my GPG Key who wasn't in a food format even after the command sed :/. Regards,