ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.9k stars 3.4k forks source link

cannot save a file after executing playbook using tower templates #14267

Open vshete93 opened 1 year ago

vshete93 commented 1 year ago

Please confirm the following

Bug Summary

Hi team,

I have been trying to save some files as a part of ansible playbook that I am executing using templates on tower. Template executes successfully but I cannot locate the files in the respective location. What can be wrong here?

AWX version

22.2.0

Select the relevant components

Installation method

kubernetes

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

Chrome

Steps to reproduce

Expected results

tower successfully saves file inside task container in the provided path (var/lib/awx/projects in my case) in the ansible playbook.

Actual results

cannot save the file and locate it

Additional information

---
- name: Backup Cisco Router or Switch
  hosts: switches
  gather_facts: no
  connection: local

  vars:
    ansible_network_os: ios
    ansible_connection: network_cli
    ansible_become: yes
    ansible_become_method: enable
    dir_name: var/lib/awx/projects/{new_folder}

  tasks:
    - name: IOS CONFIG
      ios_command:
        commands: show run
      register: output_router

    - name: Create a directory if it does not exist
      ansible.builtin.file:
        path: "{{dir_name}}"
        state: directory
        mode: '0755'

    - name: SAVE IOS CONFIG
      copy:
        content: "{{ output_router.stdout[0] }}"
        dest: "{{dir_name}}/show_run_{{ inventory_hostname }}.txt"
fosterseth commented 1 year ago
vshete93 commented 1 year ago

Hi @fosterseth thanks for your reply. However I have tried it before and havent received any response. So I post it in here and above mailing list to get some visibility at both locations. Thanks.