VSChina / vscode-ansible

VSCode extension for ansible
Other
77 stars 48 forks source link

cloud shell variables.yml dont get uploaded #207

Open ArgTang opened 5 years ago

ArgTang commented 5 years ago

Environment

Summary

Trouble running ansible playbooks. I am new to ansible and have found this vscodeplugin very helpfull. I have to issues that i have tried doing a workaround for. The first one is about using variables in another file when running with the cloud shell integration. The two others is with running scripts when using the docker integration.

  1. If running in could shell and using variables in files, cloud shell cannot fint myvariables.yml because it is not copied. How do you solve this?

  2. Calling powershell scripts in ansible playbook fails when using docker, because images does not contain powershell

  3. Calling az from shell command when running in docker, command is not run because az is not available in docker image

Reproduce steps

1:

---
- hosts: localhost
  connection: local
  tasks:
  - name: include vars 
    include_vars:
      file: test-vars.yml
      name: test
  - name: Create resource group
    azure_rm_resourcegroup:
      name: "{{test.resource_group}}"
      location: "{{test.location}}"
resource_group: testIfAnsibleWorksResourceGroup
location: westeurope
  1. ---
    - hosts: localhost
    connection: local
    tasks:
      - name: Get latest version from Azure 
      win_shell: az aks get-versions -l westeurope | ConvertFrom-Json
  2. ---
    - hosts: localhost
    connection: local
    tasks:
      - name: Get latest version from Azure 
      shell: az aks get-versions -l westeurope -o table | awk 'FNR == 3 {print $1}'

Expected Results

  1. It should be a way to select multiple files when running in couldshell, so variables files can be used
  2. When using docker, powershell should work
  3. When using docker az toolsouites should be available

Actual Results

  1. "message": "Could not find or access 'test-vars.yml"
  2. "module_stderr": "/bin/sh: 1: powershell: not found"
  3. "stderr_lines": ["/bin/sh: 1: az: not found"]
yungezz commented 5 years ago

@ArgTang thanks for reporting the issue.

ArgTang commented 5 years ago

Thanks for the tips.

This wording suggests to me that clis for cloud providers is included. It would be nice if this is clearly noted in the docs that cloud vendors clis are not included by default.

yungezz commented 5 years ago
ArgTang commented 5 years ago

@yuwzho no errors other than vars file not found.

Thanks :+1:

jhawkesworth commented 5 years ago

@yungezz please advise how to make VSCode copy all files from workspace to Cloud Shell? I think this will solve this and other open issues for VSCode ansible plugin.

My ansible configuration is many files, but the 'Upload to Cloud Shell' option only appears on files in the workspace Explorer. If I used Ctrl-Shift-P -> 'Azure: Upload to Cloud Shell' a file selector appears but it will not let me select directories, only individual files. I am using VSCode version 1.32.1 (user setup) Ansible exension version 0.5.2 Azure account extention 0.8.0