launch.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ---
  2. - hosts: localhost
  3. gather_facts: no
  4. tasks:
  5. - import_role:
  6. name: lib_utils
  7. - name: create temporary directory
  8. tempfile:
  9. state: directory
  10. register: tmp
  11. - name: download acs-engine
  12. get_url:
  13. url: "{{ item }}"
  14. dest: "{{ tmp.path }}/"
  15. with_list:
  16. - "http://acs-engine-build-acs-engine-build.svc.ci.openshift.org/acs-engine"
  17. - "http://acs-engine-build-acs-engine-build.svc.ci.openshift.org/openshift.json"
  18. - name: make acs-engine executable
  19. file:
  20. path: "{{ tmp.path }}/acs-engine"
  21. mode: 0755
  22. - name: configure acs-engine
  23. yedit:
  24. content_type: json
  25. src: "{{ tmp.path }}/openshift.json"
  26. edits:
  27. - key: properties.orchestratorProfile.openShiftConfig.clusterUsername
  28. value: demo
  29. - key: properties.orchestratorProfile.openShiftConfig.clusterPassword
  30. value: "{{ 16 | lib_utils_oo_random_word }}"
  31. - key: properties.orchestratorProfile.orchestratorVersion
  32. value: unstable
  33. # azProfile
  34. - key: properties.azProfile.tenantId
  35. value: "{{ lookup('env', 'AZURE_TENANT') }}"
  36. - key: properties.azProfile.subscriptionId
  37. value: "{{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }}"
  38. - key: properties.azProfile.resourceGroup
  39. value: "{{ openshift_azure_resource_group_name }}"
  40. - key: properties.azProfile.location
  41. value: "{{ openshift_azure_resource_location }}"
  42. # masterProfile
  43. - key: properties.masterProfile.dnsPrefix
  44. value: "a{{ 16 | lib_utils_oo_random_word }}a"
  45. - key: properties.masterProfile.imageReference.name
  46. value: "{{ openshift_azure_input_image_name }}"
  47. - key: properties.masterProfile.imageReference.resourceGroup
  48. value: "{{ openshift_azure_input_image_ns }}"
  49. - key: properties.masterProfile.vmSize
  50. value: "{{ openshift_azure_vm_size | default('Standard_D4s_v3') }}"
  51. # agentpool compute
  52. - key: properties.agentPoolProfiles[0].imageReference.name
  53. value: "{{ openshift_azure_input_image_name }}"
  54. - key: properties.agentPoolProfiles[0].imageReference.resourceGroup
  55. value: "{{ openshift_azure_input_image_ns }}"
  56. - key: properties.agentPoolProfiles[0].vmSize
  57. value: "{{ openshift_azure_vm_size | default('Standard_D4s_v3') }}"
  58. # agentpool infra
  59. - key: properties.agentPoolProfiles[1].imageReference.name
  60. value: "{{ openshift_azure_input_image_name }}"
  61. - key: properties.agentPoolProfiles[1].imageReference.resourceGroup
  62. value: "{{ openshift_azure_input_image_ns }}"
  63. - key: properties.agentPoolProfiles[1].vmSize
  64. value: "{{ openshift_azure_vm_size | default('Standard_D4s_v3') }}"
  65. # linuxprofile
  66. - key: properties.linuxProfile.adminUsername
  67. value: "cloud-user"
  68. - key: properties.linuxProfile.ssh.publicKeys[0].keyData
  69. value: "{{ openshift_azure_vm_ssh_public_key }}"
  70. # serviceprincipal
  71. - key: properties.servicePrincipalProfile.clientId
  72. value: "{{ lookup('env', 'AZURE_CLIENT_ID') }}"
  73. - key: properties.servicePrincipalProfile.secret
  74. value: "{{ lookup('env', 'AZURE_SECRET') }}"
  75. - name: run acs-engine deploy
  76. command: |
  77. {{ tmp.path }}/acs-engine deploy \
  78. --resource-group {{ openshift_azure_resource_group_name }} \
  79. --location {{ openshift_azure_resource_location }} \
  80. --subscription-id {{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }} \
  81. --auth-method client_secret \
  82. --client-id {{ lookup('env', 'AZURE_CLIENT_ID') }} \
  83. --client-secret {{ lookup('env', 'AZURE_SECRET') }} \
  84. {{ tmp.path }}/openshift.json
  85. no_log: true
  86. ignore_errors: yes
  87. register: deploy
  88. - debug:
  89. msg: "{{ deploy.stdout }}"
  90. - debug:
  91. msg: "{{ deploy.stderr }}"
  92. - name: delete temporary directory
  93. file:
  94. path: "{{ tmp.path }}"
  95. state: absent
  96. - block:
  97. - name: get azure deployment message
  98. command: >
  99. az group deployment list
  100. -g "{{ openshift_azure_resource_group_name }}"
  101. --query "[0].properties.additionalProperties.error.details[0].message"
  102. -o tsv
  103. register: message
  104. - debug:
  105. msg: "{{ (message.stdout | from_json).error.details[0].message }}"
  106. when: message.stdout != ""
  107. - assert:
  108. that: "{{ not deploy.failed }}"
  109. when: deploy.failed