From 237043578c7108a0c5a6072826689fdcb0e52e43 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Tue, 1 Jul 2025 11:35:25 -0600 Subject: [PATCH 1/3] [pfsense_zabbix_agent] Fix tlscaso typo; Lookup refids --- plugins/module_utils/zabbix_agent.py | 12 ++++++++++-- plugins/modules/pfsense_zabbix_agent.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/zabbix_agent.py b/plugins/module_utils/zabbix_agent.py index 97860ab..969bcfc 100644 --- a/plugins/module_utils/zabbix_agent.py +++ b/plugins/module_utils/zabbix_agent.py @@ -24,7 +24,7 @@ tlsconnect=dict(default='unencrypted', choices=['unencrypted', 'psk', 'cert']), tlsaccept=dict(type='list', default=['unencrypted'], choices=['unencrypted', 'psk', 'cert'], elements='str'), tlscafile=dict(type='str', default='none'), - tlscaos=dict(type='bool', default=False), + tlscaso=dict(type='bool', default=False), tlscrlfile=dict(type='str', default='none'), tlscertfile=dict(type='str', default='none'), tlspskidentity=dict(type='str', default=''), @@ -76,7 +76,7 @@ def _params_to_obj(self): self._get_ansible_param_bool(obj, key, fname='agentenabled', value='on', force=True) elif key == 'tlsaccept': obj[key] = ','.join(self.params[key]) - elif key == 'tlscaos': + elif key == 'tlscaso': self._get_ansible_param_bool(obj, key, value='on', force=True) else: self._get_ansible_param(obj, key) @@ -85,6 +85,14 @@ def _params_to_obj(self): def _validate_params(self): """ do some extra checks on input parameters """ + for key in ['tlscafile', 'tlscertfile', 'tlscrlfile']: + if self.params[key] != 'none': + elt = re.sub(r'tls(.*)file', r'\1', key) + refid = self.pfsense.get_refid(elt, self.params[key]) + if refid is None: + self.module.fail_json(msg='Could not find {0} named "{1}".'.format(key, self.params[key])) + else: + self.params[key] = refid ############################## # XML processing diff --git a/plugins/modules/pfsense_zabbix_agent.py b/plugins/modules/pfsense_zabbix_agent.py index 1a4a21a..a846b40 100644 --- a/plugins/modules/pfsense_zabbix_agent.py +++ b/plugins/modules/pfsense_zabbix_agent.py @@ -82,7 +82,7 @@ required: false default: none type: str - tlscaos: + tlscaso: description: Use the CA certificate list from the operating system. required: false default: false From abe4643dfbf69436c4320cbe66ce1822ba01a841 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Tue, 1 Jul 2025 11:36:22 -0600 Subject: [PATCH 2/3] [pfsense_zabbix_agent] base64 encode userparams --- plugins/module_utils/zabbix_agent.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/module_utils/zabbix_agent.py b/plugins/module_utils/zabbix_agent.py index 969bcfc..623976d 100644 --- a/plugins/module_utils/zabbix_agent.py +++ b/plugins/module_utils/zabbix_agent.py @@ -78,6 +78,8 @@ def _params_to_obj(self): obj[key] = ','.join(self.params[key]) elif key == 'tlscaso': self._get_ansible_param_bool(obj, key, value='on', force=True) + elif key == 'userparams': + obj['userparams'] = base64.b64encode(self.params[key].encode()).decode() else: self._get_ansible_param(obj, key) From 5edbafc34ce812b8145d52cd31aee28b0834b983 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Tue, 1 Jul 2025 11:43:17 -0600 Subject: [PATCH 3/3] [ci] Update versions, use variable for repo name --- .github/workflows/main.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 23fe147..ee433e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,22 +18,22 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8'] - ansible-version: ['2.11', '2.12', '2.13'] + python-version: ['3.10'] + ansible-version: ['2.14', '2.15', '2.16', '2.17'] # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Cache pip modules - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-pip with: @@ -42,7 +42,7 @@ jobs: key: ${{ runner.os }}-build-${{ env.cache-name }}-python-${{ matrix.python-version }} - name: Cache ansible setup - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-ansible with: @@ -53,7 +53,7 @@ jobs: # Runs a set of commands using the runners shell - name: Install ansible and deps run: | - pip install ansible-base dnspython parameterized pyyaml + pip install ansible-core==${{ matrix.ansible-version }}.* dnspython parameterized pyyaml ansible-galaxy collection install community.internal_test_tools pfsensible.core - name: Run ansible tests @@ -62,7 +62,7 @@ jobs: dir=$(pwd) mkdir -p ~/.ansible/collections/ansible_collections/pfsensible cd ~/.ansible/collections/ansible_collections/pfsensible - cp -al $dir zabbix - cd zabbix + cp -al $dir ${{ github.event.repository.name }} + cd ${{ github.event.repository.name }} ansible-test sanity --requirements --python ${{ matrix.python-version }} #ansible-test units --requirements --python ${{ matrix.python-version }}