Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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 }}
14 changes: 12 additions & 2 deletions plugins/module_utils/zabbix_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=''),
Expand Down Expand Up @@ -76,15 +76,25 @@ 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)
elif key == 'userparams':
obj['userparams'] = base64.b64encode(self.params[key].encode()).decode()
else:
self._get_ansible_param(obj, key)

return dict(config=obj)

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
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/pfsense_zabbix_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down