summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/ise/playbooks/backup_create.yml
blob: 10913633310439e9ea77a5ecce7f66000b8b5218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
- hosts: ise_servers
  gather_facts: false
  name: Backup configuration
  tasks:
    - name: Create a repository
      cisco.ise.repository:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
        state: present
        name: myRepo
        password: MyP@ssworD
        path: /
        protocol: DISK

    - name: Create backup
      cisco.ise.backup_config:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
        backupEncryptionKey: My3ncryptionkey
        backupName: myBackup
        repositoryName: myRepo
      register: result

    - name: Get Tasks by id
      cisco.ise.tasks_info:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
        taskId: "{{ result.ise_response.response.id }}"
      when:
        - result is defined
        - result['ise_response'] is defined
        - result['ise_response']['response']
        - result['ise_response']['response']['id'] is defined
      register: task_status

    - name: Show task status
      ansible.builtin.debug:
        msg: "{{ task_status }}"