forked from russmckendrick/DevOpsAnsiblePipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
45 lines (36 loc) · 1.29 KB
/
azure-pipelines.yml
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
# Ansible pipeline
# Tesing
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
displayName: 'Install Python'
inputs:
versionSpec: '3.6'
- task: AzureCLI@2
displayName: 'Azure CLI'
inputs:
azureSubscription: '$(SUBSCRIPTION_NAME)'
addSpnToEnvironment: true
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
echo "##vso[task.setvariable variable=ARM_SUBSCRIPTION_ID]$(az account show --query="id" -o tsv)"
echo "##vso[task.setvariable variable=ARM_CLIENT_ID]${servicePrincipalId}"
echo "##vso[task.setvariable variable=ARM_CLIENT_SECRET]${servicePrincipalKey}"
echo "##vso[task.setvariable variable=ARM_TENANT_ID]${tenantId}"
- script: pip install ansible
displayName: 'Install Ansible'
- script: pip install -r https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt
displayName: 'Install Azure modules needed'
- script: ansible-galaxy collection install azure.azcollection
displayName: 'Install Ansible Azure Collection'
- script: ansible-playbook -i inv site.yml
displayName: 'Run Ansible Playbook'
env:
AZURE_CLIENT_ID: $(ARM_CLIENT_ID)
AZURE_SECRET: $(ARM_CLIENT_SECRET)
AZURE_TENANT: $(ARM_TENANT_ID)
AZURE_SUBSCRIPTION_ID: $(ARM_SUBSCRIPTION_ID)