launch.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. # agentpool compute
  50. - key: properties.agentPoolProfiles[0].imageReference.name
  51. value: "{{ openshift_azure_input_image_name }}"
  52. - key: properties.agentPoolProfiles[0].imageReference.resourceGroup
  53. value: "{{ openshift_azure_input_image_ns }}"
  54. # agentpool infra
  55. - key: properties.agentPoolProfiles[1].imageReference.name
  56. value: "{{ openshift_azure_input_image_name }}"
  57. - key: properties.agentPoolProfiles[1].imageReference.resourceGroup
  58. value: "{{ openshift_azure_input_image_ns }}"
  59. # linuxprofile
  60. - key: properties.linuxProfile.adminUsername
  61. value: "cloud-user"
  62. - key: properties.linuxProfile.ssh.publicKeys[0].keyData
  63. value: "{{ openshift_azure_vm_ssh_public_key }}"
  64. # serviceprincipal
  65. - key: properties.servicePrincipalProfile.clientId
  66. value: "{{ lookup('env', 'AZURE_CLIENT_ID') }}"
  67. - key: properties.servicePrincipalProfile.secret
  68. value: "{{ lookup('env', 'AZURE_SECRET') }}"
  69. - name: run acs-engine deploy
  70. command: |
  71. {{ tmp.path }}/acs-engine deploy \
  72. --resource-group {{ openshift_azure_resource_group_name }} \
  73. --location {{ openshift_azure_resource_location }} \
  74. --subscription-id {{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }} \
  75. --auth-method client_secret \
  76. --client-id {{ lookup('env', 'AZURE_CLIENT_ID') }} \
  77. --client-secret {{ lookup('env', 'AZURE_SECRET') }} \
  78. {{ tmp.path }}/openshift.json
  79. no_log: true
  80. ignore_errors: yes
  81. register: deploy
  82. - debug:
  83. msg: "{{ deploy.stdout }}"
  84. - debug:
  85. msg: "{{ deploy.stderr }}"
  86. - name: delete temporary directory
  87. file:
  88. path: "{{ tmp.path }}"
  89. state: absent
  90. - block:
  91. - name: get azure deployment message
  92. command: >
  93. az group deployment list
  94. -g "{{ openshift_azure_resource_group_name }}"
  95. --query "[0].properties.additionalProperties.error.details[0].message"
  96. -o tsv
  97. register: message
  98. - debug:
  99. msg: "{{ (message.stdout | from_json).error.details[0].message }}"
  100. - assert:
  101. that: "{{ not deploy.failed }}"
  102. when: deploy.failed