--- - name: This playbook manages creating and updating the templates projects and templates on Cisco Catalyst Center hosts: catalyst_center_hosts connection: local gather_facts: no vars: state: merged catalyst_center_login: &catalyst_center_login catalystcenter_host: "{{ catalyst_center_host | default(catalystcenter_host) }}" catalystcenter_username: "{{ catalyst_center_username | default(catalystcenter_username) }}" catalystcenter_password: "{{ catalyst_center_password | default(catalystcenter_password) }}" catalystcenter_version: "{{ catalyst_center_version | default(catalystcenter_version) }}" catalystcenter_port: "{{ catalyst_center_port | default(443) }}" catalystcenter_verify: "{{ catalyst_center_verify | default(catalystcenter_verify) }}" config_verify: "{{ catalyst_center_config_verify | default(False) }}" catalystcenter_debug: "{{ catalyst_center_debug | default(False) }}" catalystcenter_log: "{{ catalyst_center_log | default(False) }}" catalystcenter_log_level: "{{ catalyst_center_log_level | default('INFO') }}" catalystcenter_log_file_path: "{{ catalyst_center_log_file_path | default(omit) }}" catalystcenter_log_append: "{{ catalyst_center_log_append | default(False) }}" catalystcenter_api_task_timeout: "{{ catalyst_center_api_task_timeout | default(1200) }}" tasks: # ========================================================================= # Input loading: vars file (VARS_FILE_PATH) or inventory variables # ========================================================================= - name: Load input variables from vars file when VARS_FILE_PATH is provided ansible.builtin.include_vars: file: "{{ VARS_FILE_PATH }}" when: - VARS_FILE_PATH is defined - VARS_FILE_PATH | length > 0 - name: Print input source ansible.builtin.debug: msg: >- {{ 'Input source: vars file ' ~ VARS_FILE_PATH if (VARS_FILE_PATH is defined and VARS_FILE_PATH | length > 0) else 'Input source: inventory / host variables (VARS_FILE_PATH not provided)' }} - name: Validate that template_details is defined ansible.builtin.fail: msg: >- Variable 'template_details' is not defined. Provide it via VARS_FILE_PATH or as an inventory/host variable. when: template_details is not defined - name: Templates Playbook start time set_fact: long_op_start: "{{ now() }}" - name: Templates Playbook start time #Import an image from a URL cisco.catalystcenter.template_workflow_manager: <<: *catalyst_center_login state: "{{ state }}" config: "{{ template_details }}" register: template_output when: template_details is defined - name: Print the Templates output debug: msg: "{{template_output}}" when: template_output is defined - name: Templates playbook end time set_fact: long_op_end: "{{ now() }}" - name: Print Templates Playbook execution time debug: msg: "Templates playbook run time: {{ long_op_start }}, end: {{ long_op_end }}" post_tasks: - name: run command module to find python version ansible.builtin.command: which python register: ansible_play_path delegate_to: catalyst_center_hosts connection: local