0

Can u spot anything wrong on host definition below?

# ansible --list-hosts -i inventory  -m fortimgr revision.yml
No hosts matched
root@vuwunicoids0001:/home/scripts/fortimanager# cat inventory
[all:vars]
ansible_python_interpreter=python

[fortimanager]
vuwvapcofmg0001 ansible_ssh_host=10.190.10.75 ansible_ssh_user=automation ansible_ssh_password=abc123
root@vuwunicoids0001:/home/scripts/fortimanager# cat revision.yml
---
- name: DEMONSTRATE REVISIONS
  hosts: fortimanager
  connection: local
  gather_facts: false
  tasks:
    - name: CREATE NEW REVISION
      fortimgr_revision:
        host: "{{ ansible_ssh_host }}"
        username: "{{ ansible_ssh_user }}"
        password: "{{ ansible_ssh_password }}"
        adom: "root"
        created_by: "automation"
        description: "ADOM Revision"
        revision_name: "Lab Revision"

    - name: DELETE REVISION
      fortimgr_revision:
        host: "{{ ansible_ssh_host }}"
        username: "{{ ansible_ssh_user }}"
        password: "{{ ansible_ssh_password }}"
        adom: "root"
        revision_name: "Lab Revision"
        state: "absent"

    - name: RESTORE REVISION
      fortimgr_revision:
        host: "{{ ansible_ssh_host }}"
        username: "{{ ansible_ssh_user }}"
        password: "{{ ansible_ssh_password }}"
        adom: "root"
        created_by: "automatino"
        description: "ADOM Revert"
        revision_name: "Good Revision"
        restore_name: "Rollback"
0

There are multiple issues with what you're doing.

  • Problem: You're passing revision.yml as the host pattern to the ansible command, which is why there are no hosts matched.
    Solution: You are actually trying to run a playbook, so you should be using the ansible-playbook command instead of ansible.
  • Problem: There is no such module as fortimgr in Ansible.
    Solution: Remove -m fortimgr from your command that now begins with ansible-playbook.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.