Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_Wagner
Participant
Jump to solution

Deploy file using ansible

Hello,

I want to automate file deployment on multiple management servers and gateways using ansible.

Sincerely, I don't get it running.

Playbook:

---
# Copy demo.txt to Check Point Management

- name: Copy file
hosts: checkpoint_management

tasks:
- name: Copy file
copy:
src: /home/xx/xx/ansible/demo.txt
dest: /home/xx/demo.txt

 

Result from running ansible-playbook copy-file.yml:

fatal: [xx.xx.xx.202]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.setup": {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "exception": "Traceback (most recent call last):
File \"/home/xx/.ansible/tmp/ansible-tmp-1684305632.491652-3376170-41574932784899/AnsiballZ_setup.py\", line 102, in <module>
_ansiballz_main()
File \"/home/xx/.ansible/tmp/ansible-tmp-1684305632.491652-3376170-41574932784899/AnsiballZ_setup.py\", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/home/xx/.ansible/tmp/ansible-tmp-1684305632.491652-3376170-41574932784899/AnsiballZ_setup.py\", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.setup', init_globals=None, run_name='__main__', alter_sys=True)
File \"/opt/CPsuite-R81.10/fw1/Python/lib/python2.7/runpy.py\", line 188, in run_module\r\n fname, loader, pkg_name)
File \"/opt/CPsuite-R81.10/fw1/Python/lib/python2.7/runpy.py\", line 82, in _run_module_code\r\n mod_name, mod_fname, mod_loader, pkg_name)
File \"/opt/CPsuite-R81.10/fw1/Python/lib/python2.7/runpy.py\", line 72, in _run_code\r\n exec code in run_globals
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/modules/setup.py\", line 130, in <module>
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/facts/__init__.py\", line 34, in <module>
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/facts/compat.py\", line 33, in <module>
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/facts/default_collectors.py\", line 51, in <module>
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/facts/system/service_mgr.py\", line 35, in <module>
ImportError: No module named distutils.version\r\n", "failed": true, "module_stderr": "Shared connection to xx.xx.xx.202 closed.\r\n", "module_stdout": "Traceback (most recent call last):
File \"/home/xx/.ansible/tmp/ansible-tmp-1684305632.491652-3376170-41574932784899/AnsiballZ_setup.py\", line 102, in <module>\r\n _ansiballz_main()
File \"/home/xx/.ansible/tmp/ansible-tmp-1684305632.491652-3376170-41574932784899/AnsiballZ_setup.py\", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File \"/home/xx/.ansible/tmp/ansible-tmp-1684305632.491652-3376170-41574932784899/AnsiballZ_setup.py\", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.setup', init_globals=None, run_name='__main__', alter_sys=True)\r\n File \"/opt/CPsuite-R81.10/fw1/Python/lib/python2.7/runpy.py\", line 188, in run_module
fname, loader, pkg_name)\r\n File \"/opt/CPsuite-R81.10/fw1/Python/lib/python2.7/runpy.py\", line 82, in _run_module_code mod_name, mod_fname, mod_loader, pkg_name)
File \"/opt/CPsuite-R81.10/fw1/Python/lib/python2.7/runpy.py\", line 72, in _run_code
exec code in run_globals\r\n File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/modules/setup.py\", line 130, in <module>
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/facts/__init__.py\", line 34, in <module>
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/facts/compat.py\", line 33, in <module>
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/facts/default_collectors.py\", line 51, in <module>
File \"/tmp/ansible_ansible.legacy.setup_payload_duRtha/ansible_ansible.legacy.setup_payload.zip/ansible/module_utils/facts/system/service_mgr.py\", line 35, in <module>
ImportError: No module named distutils.version\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1, "warnings": ["Platform linux on host xx.xx.xx.202 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change the meaning of that path. See removed bc spam for more information."]}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"}

 I cannot find any helpful documentation on this, maybe you have a tip for me?

0 Kudos
1 Solution

Accepted Solutions
Erik_Lagzdins
Employee Employee
Employee

I believe it's because you did not specify to NOT gather facts in your playbook. Check Point does not support it.

 

---
- name: "Copy file to MDS"
gather_facts: no
hosts: mds

tasks:
- name: Transfer file
copy:
src: test.txt
dest: /var/log/tmp/test.txt
force: no

View solution in original post

3 Replies
PhoneBoy
Admin
Admin

To the best of my knowledge, we only support our own Ansible modules on Check Point appliances.

0 Kudos
Erik_Lagzdins
Employee Employee
Employee

I believe it's because you did not specify to NOT gather facts in your playbook. Check Point does not support it.

 

---
- name: "Copy file to MDS"
gather_facts: no
hosts: mds

tasks:
- name: Transfer file
copy:
src: test.txt
dest: /var/log/tmp/test.txt
force: no

Michael_Wagner
Participant

Thanks, that workes!

0 Kudos
Upcoming Events

    CheckMates Events