awx_configuration.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. # Deleting the defaults
  16. - name: Delete machine credential
  17. awx.awx.tower_credential:
  18. name: "{{ default_credential }}"
  19. credential_type: "{{ default_credential_type }}"
  20. state: absent
  21. tower_config_file: "~/.tower_cli.cfg"
  22. - name: Delete job template
  23. awx.awx.tower_job_template:
  24. name: "{{ default_template }}"
  25. state: absent
  26. tower_config_file: "~/.tower_cli.cfg"
  27. - name: Delete project
  28. awx.awx.tower_project:
  29. name: "{{ default_project }}"
  30. state: absent
  31. tower_config_file: "~/.tower_cli.cfg"
  32. - name: Delete organization
  33. awx.awx.tower_organization:
  34. name: "{{ default_org }}"
  35. state: absent
  36. tower_config_file: "~/.tower_cli.cfg"
  37. # Configuration begins
  38. - name: Create organization
  39. awx.awx.tower_organization:
  40. name: "{{ awx_organization }}"
  41. description: "Name of organization using this product"
  42. state: present
  43. tower_config_file: "~/.tower_cli.cfg"
  44. - name: Create awx inventories
  45. awx.awx.tower_inventory:
  46. name: "{{ item.name }}"
  47. description: "{{ item.description }}"
  48. organization: "{{ awx_organization }}"
  49. state: present
  50. tower_config_file: "~/.tower_cli.cfg"
  51. loop: "{{ inventory_names }}"
  52. when: item.flag
  53. - name: Add groups to node_inventory
  54. awx.awx.tower_group:
  55. name: "{{ item.name }}"
  56. description: "{{ item.description }}"
  57. inventory: "node_inventory"
  58. state: present
  59. tower_config_file: "~/.tower_cli.cfg"
  60. loop: "{{ group_names }}"
  61. - name: Add project
  62. awx.awx.tower_project:
  63. name: "{{ project_name }}"
  64. description: "{{ project_description }}"
  65. organization: "{{ awx_organization }}"
  66. scm_type: manual
  67. local_path: "{{ role_path.split('/')[-4] }}"
  68. default_environment: "custom-awx-ee"
  69. state: present
  70. tower_config_file: "~/.tower_cli.cfg"
  71. - name: Add awx credentials
  72. awx.awx.tower_credential:
  73. name: "{{ item.name }}"
  74. organization: "{{ awx_organization }}"
  75. credential_type: "{{ item.type }}"
  76. inputs:
  77. username: "{{ item.username }}"
  78. password: "{{ item.password }}"
  79. state: present
  80. tower_config_file: "~/.tower_cli.cfg"
  81. loop: "{{ credential_details }}"
  82. changed_when: true
  83. when: item.flag
  84. - name: Create awx job templates
  85. awx.awx.tower_job_template:
  86. name: "{{ item.name }}"
  87. job_type: "run"
  88. organization: "{{ awx_organization }}"
  89. inventory: "{{ item.inventory }}"
  90. project: "{{ project_name }}"
  91. playbook: "{{ item.playbook }}"
  92. credentials:
  93. - "{{ item.credential }}"
  94. state: present
  95. tower_config_file: "~/.tower_cli.cfg"
  96. loop: "{{ job_template_details }}"
  97. when: item.flag
  98. - name: Create deploy_omnia_template
  99. awx.awx.tower_job_template:
  100. name: "{{ item.name }}"
  101. job_type: "run"
  102. organization: "{{ awx_organization }}"
  103. inventory: "{{ item.inventory }}"
  104. project: "{{ project_name }}"
  105. playbook: "{{ item.playbook }}"
  106. credentials:
  107. - "{{ item.credential }}"
  108. ask_skip_tags_on_launch: true
  109. state: present
  110. tower_config_file: "~/.tower_cli.cfg"
  111. loop: "{{ deploy_omnia_details }}"
  112. - name: Build a schedule for idrac job template
  113. awx.awx.tower_schedule:
  114. name: "{{ item.name }}"
  115. unified_job_template: "{{ item.template }}"
  116. rrule: "{{ schedule_rule }}"
  117. state: present
  118. tower_config_file: "~/.tower_cli.cfg"
  119. register: result
  120. loop: "{{ scheduled_templates}}"