ops-cli | cli wrapper Terraform , Ansible , Helmfile and SSH | Infrastructure Automation library
kandi X-RAY | ops-cli Summary
kandi X-RAY | ops-cli Summary
ops-cli is a python wrapper for Terraform, Ansible and SSH for cloud automation. We use multiple tools to manage our infrastructure at Adobe. The purpose of ops-cli is to gather the common cluster configurations in a single place and, based on these, interact with the above mentioned tools. In this way, we can avoid duplication and can quickly spin up new clusters (either production or development ones). All we need to do is customize the cluster configuration file (example here). ops-cli integrates with the Azure and AWS cli, in order to provide inventory, ssh, sync, tunnel and the possibility to run ansible playbooks on a fleet of EC2 instances. It can be used to add a layer of templating (using jinja2) on top of Terraform files. This is useful for removing duplicated code when it comes to spinning up infrastructure across multiple environments (stage/sandbox/prod) and across teams. Useful for both AWS and Kubernetes deployments.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- List credentials
- Get a list of messages by type
- Get response dictionary
- Send a request
- Run ansible_SSH command
- Checks if the given argument is in the given container
- Execute ansible - playbook
- Create a path expression with the given user and path
- Configure the server
- Configure common arguments
- Generate legacy pcs
- Generate the Helmfile configuration
- Configure the command line arguments
- Returns the host info
- Generate the ssh proxy port
- Load the ssh keys
- Enables skms session optimization
- Generate the ssh keypair
- Parse CLI arguments
- Get authentication credentials
- Run packer
- Returns the inventory for the resource group
- Return a templar instance
- Load the settings
- Execute cns plugin
- Render the configuration
ops-cli Key Features
ops-cli Examples and Code Snippets
Community Discussions
Trending Discussions on ops-cli
QUESTION
ANSWER
Answered 2021-Oct-06 at 12:04Maybe there is a product issue recently, as the Azure CLI should work, it worked for me last month, see here.
For now, if you want to list the projects, you could call the REST API Projects - List directly in PowerShell task.
QUESTION
Trying to dynamically retrieve all the variables from a variable group via Azure DevOps task in a YAML Pipeline. Originally tried leveraging the AzureCLI@2 task with the following code to retrieve the variableGroupID which would be used to get the variables inside of it:
...ANSWER
Answered 2021-Feb-11 at 06:33You can use the REST API instead of Azure CLI to get the information. It can be used with the standard tools already present on the Microsoft Hosted agents. It requires only vanilla powershell or powershell core, meaning to works on both windows and linux agents. The below example was successfully tested on windows-latest
/windows-2019
and ubuntu-latest
/ubuntu-20.04
The approach is the same as with Azure CLI.
- List all available groups filtered by name to retrieve the variable group in question
- Get all variables in the variable group using the variable group id from step
In fact, the pipeline also has an out of the box PAT token available with read access to variable groups. It is stored in the variable System.AccessToken
. Using that instead of a manually managed one will further simplify things.
The script below is executed in a pwsh
step, which is the built in Powershell task in Powershell core mode
QUESTION
I want to trigger a specific Azure pipeline through REST API. I have checked this documentation . So the core message will be:
...ANSWER
Answered 2020-Nov-20 at 13:37pipelineId
is equal to definitionId
So please go to your pipeline and check url like this https://dev.azure.com/thecodemanual/DevOps%20Manual/_build?definitionId=177
.
Or use this endpoint to get list of deifnitions:
QUESTION
I want to be able to connect an existing branch in a git repo to a work item in Azure DevOps, via CLI or API or any way that isn't the UI (I do that all day long in the UI and want to make a script instead). I found this open issue in GitHub: https://github.com/Azure/azure-devops-cli-extension/issues/153
My take-away from this is that this feature is not implemented in the extension. Instead, I turned to the REST API. But I can't figure out how to do what I want. Creating a new branch and connect it in the same operation would be ok as well, but preferably I want to just connect an existing branch.
Any help pointing me in the right direction would be greatly appreciated.
...ANSWER
Answered 2020-Oct-29 at 09:53The documentation does not contain explnaition of your issue, but you can try this example with rest API through PowerShell:
QUESTION
I want to execute AZ cli commands from my Azure DevOps Pipeline. In my YAML file I have this:
...ANSWER
Answered 2020-Oct-23 at 14:44No, you don't need az devops login
. What you need is Azure CLI Task:
QUESTION
Say we have following branches:
- Master
- Sprint
- Stories
Stories can be merged to sprint (for sprint items) or Master (for hotfix) and we want is this:
- Sprint branch to be deployed to PreProd Environment
- If QA is happy, sprint branch will be merged to master and then deployed to UAT, then QA.
We wants to protect master or sprint branch, so they can only be changed via PR request.
Other than QA manually create a PR and then merge to master branch, I would like to do it in a build task. So I tried to use Azure CLI task to run a batch:
...ANSWER
Answered 2020-Sep-02 at 16:52Solution 1And if it is ok, how can I create and finish a PR request in build pipeline?
The easiest way would be to use Create Pull Request Task with "Set Auto Complete" option checked.
Solution 2If you want to do it from CLI, generate PAT Token:
Save it as secret variable:
An use powershell to save it as env variable
QUESTION
I have created a new token with Agent Pool read and manage permissions. I have created a new agent pool lnx_agent wherein I have administrator role to manage it. When I download tar file of agent linux x64 from this link https://vstsagentpackage-azureedge-net.o365.example-domain.defendernet.com/agent/2.171.1/vsts-agent-linux-x64-2.171.1.tar.gz, copy it to bastion host, unpack it and execute ./config.sh with URL, PAT token, agent pool as lnx_agent and default agent name as bastion_agent; I have below error message.
...ANSWER
Answered 2020-Jun-29 at 04:25Firstly, please make sure you can access the Azure DevOps organization (https://dev.azure.com/{organization}
) from the bastion host. Otherwise we cannot connect to the Azure DevOps services.
Secondly, please check if you are running a firewall or a proxy on the bastion host. If you're running an agent in a secure network behind a firewall, make sure the agent can initiate communication with the URLs and IP addresses mentioned in below documents.
QUESTION
Requirement
So, there is some newish functionality in Azure DevOps which allows pipelines to trigger other pipelines and is documented here: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=azure-devops&tabs=yaml#pipeline-triggers-1 It sounds great, apart from the fact I can't get the behaviour I need. I want 2 pipelines in the same repository:
- Pipeline A: is only triggered by multiple other pipelines outside of its own repo, but in the same project. As a result of being triggered it makes a change to its own repo and therefore triggers pipeline B.
- Pipleline B: is only triggered by changes to its own repo and when triggered goes ahead and does whatever it needs to do
Pipeline A Syntax
...ANSWER
Answered 2020-Jan-07 at 23:01Working Solution
Because all of my builds are centralised in one pipeline template, I changed this template to trigger my pipeline A on successful publishing of an artifact. Here's the pipeline trigger code which is pretty much verbatim from (https://docs.microsoft.com/en-us/azure/devops/cli/azure-devops-cli-in-yaml?view=azure-devops), apart from the last couple of steps:
QUESTION
I've installed AZ DEVOPS extension from az cli
...ANSWER
Answered 2020-Apr-08 at 06:57As a prerequisite,your Azure CLI version must be 2.0.49 at a minimum. You can use az --version
to validate.
After you add az extension, you could also run az login
to sign in.
If you have already signed in with az login interactively or using user name and password, then you don't have to provide a token as az devops commands now support sign in through az login.
When you are using az devops login command, first make sure you are using Azure DevOps Service organization URL. Example: https://dev.azure.com/MyOrganizationName
. Azure DevOps Server/TFS is not support at present.
For Azure DevOps tokens, you need to make sure it's valid and with enough scopes for this token to authorize for your specific tasks.
More details please refer our official tutorial here-- Sign in with a Personal Access Token (PAT)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ops-cli
You can use ops-cli like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page