Configuring Solace with Ansible : ERROR! couldn't resolve module/action 'solace_client_username'

Qais
Qais Member Posts: 9
edited February 2022 in PubSub+ Event Broker #1

Hi there,
I am trying to use Ansible to configure solace (create client usernames and acl-profles) however i get an Error (at least one right now). The error says:

ERROR! couldn't resolve module/action 'solace_client_username'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/Users/quais/reddi_infrastructure/ansible/solace-cloud/ansible-code/playbook.create-sc-client.yml': line 10, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
  - name: Remove Client
    ^ here


  
    
      ERROR ...
    
  


Apparently it cannot resolve module action 'solace_client_username'. I have to admit that the playbook.create-sc.client.yml was not already in the repo (written by @swenhelge I guess) (below), I had to create it.
I used this Repo and added the playbook.create-sc-client.yml which is also below https://github.com/solace-iot-team/ansible-solace/tree/master/working-with-solace-cloud

- name: Playbook to add a client named 'nemo-ansible'
  hosts: localhost
  vars:
    msg_vpn: reddi
    client_profile: default
    client: nemo-ansible
    client_password: ansible123
  tasks:

  - name: Remove Client
    solace_client_username:
      name: "{{ client }}"
      msg_vpn: "{{ msg_vpn }}"
      state: absent

  - name: Add Client
    solace_client_username:
      name: "{{ client }}"
      msg_vpn: "{{ msg_vpn }}"
      settings:
        clientProfileName: "{{ client_profile }}"
        password: "{{ client_password }}"

  - name: Update Client password
    solace_client_username:
      name: "{{ client }}"
      msg_vpn: "{{ msg_vpn }}"
      settings:
        password: "{{ client_password }}_new" # not in response so always changed

Comments

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    Hi Qais,

    This looks to be ansible environment glitch to me. I just tested with ansible 2.10 on my Mac (installed with pip3) and got the same error. Looks like it can't find the modules under network/solace. I'll update here when I got a fix.
    What is your ansible version?

  • Qais
    Qais Member Posts: 9

    Hi @arih ,
    thanks for looking into this. My Ansible version is 2.10.2
    I had a look at the ansible module documentation apparently these modules we need for solace don't exist (anymore).
    https://docs.ansible.com/ansible/2.3/list_of_all_modules.html

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    Hi Qais,

    I'm not sure about the Ansible 2.3 list of modules there, but I just quickly try and use my Ubuntu VM with Ansible 2.9.6, and put the Ansible-solace modules in my local plugin dir and it works as expected.

  • Qais
    Qais Member Posts: 9

    @arih okay that helps. But are the modules somewhere in the Repo? or do you get them from somewhere else?

  • arih
    arih Member, Employee Posts: 125 Solace Employee

    Hi @Qais , I used pip as shown in the repo, but then I just copy over the modules to my own plugin folder from wherever the pip installs it. That is just one way to do things tough, you can check Ansible doc on other ways to use modules.

  • swenhelge
    swenhelge Member, Employee Posts: 77 Solace Employee
    edited October 2020 #7

    Hi
    Just came across this discussion.

    The modules currently DON'T work with ansible 2.10, you would need to use something like 2.9.11, e.g. sudo pip3 install ansible==2.9.11, then install ansible solace via pip. See the prerequisites here - https://github.com/solace-iot-team/ansible-solace, Ricardo has also added a dedicated installation examples page - https://github.com/solace-iot-team/ansible-solace/blob/master/Install.md

  • solcache
    solcache Member Posts: 7

    I am getting a similar issue to this ansible version is 2.9.11

  • solcache
    solcache Member Posts: 7
    edited August 2021 #9

    I had an issue similar to this,

    ERROR! couldn't resolve module/action 'solace_acl_publish_topic_exception'.

    To fix the issue I went into the Ansible module directory:
    (/collections/ansible_collections/solace/pubsub_plus/plugins/modules)

    Opened the python file related to the module I was trying to use: solace_acl_publish_topic_exception.py

    Under the following function I update the code block to return '<=2.13' for semp version '>= 2.14' and it worked:

    def get_sempv2_version_map_key(self, semp_version: float) -> str:
            if semp_version <= 2.13:
                return '<=2.13'
            elif semp_version >= 2.14:
                return '<=2.13'
                #return '>=2.14'
    

This Month's Leaders