Skip to content

Commit

Permalink
updating playbooks to dispatch (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
djdanielsson authored Apr 27, 2024
1 parent 3eb29e7 commit b7ae02f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 293 deletions.
122 changes: 2 additions & 120 deletions playbooks/controller_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,6 @@
- ../vaults/{{ env }}.yml
connection: local
tasks:
- name: Include setting role
ansible.builtin.include_role:
name: infra.controller_configuration.settings
when: controller_settings | length is not match('0')

- name: Include organization role
ansible.builtin.include_role:
name: infra.controller_configuration.organizations
vars:
assign_galaxy_credentials_to_org: false
assign_default_ee_to_org: false
when: controller_organizations | length is not match('0')

- name: Include labels role
ansible.builtin.include_role:
name: infra.controller_configuration.labels
when: controller_labels | length is not match('0')

- name: Include users role
ansible.builtin.include_role:
name: infra.controller_configuration.users
vars:
controller_configuration_users_secure_logging: true
when: controller_user_accounts | length is not match('0')

- name: Include teams role
ansible.builtin.include_role:
name: infra.controller_configuration.teams
when: controller_teams | length is not match('0')

# probably not good but kinda works, looking for better solutions,
# you are better off removing this block and getting token into vault by hand
- name: Figuring out AH token
Expand All @@ -53,96 +23,8 @@
ansible.builtin.set_fact:
ah_token: "{{ ah_token['token'] }}"
when: r_ah_token['changed'] # noqa: no-handler
# what needs to be done to guarantee this to work?

- name: Include credential_types role
ansible.builtin.include_role:
name: infra.controller_configuration.credential_types
when: controller_credential_types | length is not match('0')

- name: Include credential role
ansible.builtin.include_role:
name: infra.controller_configuration.credentials
vars:
controller_configuration_credentials_secure_logging: true
when: controller_credentials | length is not match('0')

- name: Include credential_input_sources role
ansible.builtin.include_role:
name: infra.controller_configuration.credential_input_sources
when: controller_credential_input_sources | length is not match('0')

- name: Include instance_groups role
ansible.builtin.include_role:
name: infra.controller_configuration.instance_groups
when: controller_instance_groups | length is not match('0')

- name: Include execution_environments role
ansible.builtin.include_role:
name: infra.controller_configuration.execution_environments
when: controller_execution_environments | length is not match('0')

- name: Include organizations role
ansible.builtin.include_role:
name: infra.controller_configuration.organizations
when: controller_organizations | length is not match('0')

- name: Include Notification role
ansible.builtin.include_role:
name: infra.controller_configuration.notification_templates
when: controller_notifications | length is not match('0')

- name: Include projects role
ansible.builtin.include_role:
name: infra.controller_configuration.projects
when: controller_projects | length is not match('0')

- name: Include inventories role
ansible.builtin.include_role:
name: infra.controller_configuration.inventories
when: controller_inventories | length is not match('0')

- name: Include inventory_sources role
ansible.builtin.include_role:
name: infra.controller_configuration.inventory_sources
when: controller_inventory_sources | length is not match('0')

- name: Include inventory_source_update role
ansible.builtin.include_role:
name: infra.controller_configuration.inventory_source_update

- name: Include groups role
ansible.builtin.include_role:
name: infra.controller_configuration.groups
when: controller_groups | length is not match('0')

- name: Include hosts role
ansible.builtin.include_role:
name: infra.controller_configuration.hosts
when: controller_hosts | length is not match('0')

- name: Include applications role
ansible.builtin.include_role:
name: infra.controller_configuration.applications
when: controller_applications | length is not match('0')

- name: Include job_templates role
ansible.builtin.include_role:
name: infra.controller_configuration.job_templates
when: controller_templates | length is not match('0')

- name: Include workflow_job_templates role
ansible.builtin.include_role:
name: infra.controller_configuration.workflow_job_templates
when: controller_workflows | length is not match('0')

- name: Include schedules role
ansible.builtin.include_role:
name: infra.controller_configuration.schedules
when: controller_schedules | length is not match('0')

- name: Include roles role
- name: Call dispatch role
ansible.builtin.include_role:
name: infra.controller_configuration.roles
when: controller_roles | length is not match('0')
name: infra.controller_configuration.dispatch
...
25 changes: 2 additions & 23 deletions playbooks/eda_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,8 @@
- "../vaults/{{ env }}.yml"
connection: local
tasks:
- name: Include credential role
- name: Call dispatch role
ansible.builtin.include_role:
name: infra.eda_configuration.credential
when: eda_credentials is defined

- name: Include project role
ansible.builtin.include_role:
name: infra.eda_configuration.project
when: eda_projects is defined

- name: Include project_sync role
ansible.builtin.include_role:
name: infra.eda_configuration.project_sync
when: eda_projects is defined

- name: Include decision_environment role
ansible.builtin.include_role:
name: infra.eda_configuration.decision_environment
when: eda_decision_environments is defined

- name: Include rulebook_activation role
ansible.builtin.include_role:
name: infra.eda_configuration.rulebook_activation
when: eda_rulebook_activations is defined
name: infra.eda_configuration.dispatch

...
5 changes: 5 additions & 0 deletions playbooks/hub_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
vars_files:
- ../vaults/{{ env }}.yml
tasks:
# Pending a bug fix
# - name: Include dispatch role
# ansible.builtin.include_role:
# name: infra.ah_configuration.dispatch

- name: Include collection_remote role
ansible.builtin.include_role:
name: infra.ah_configuration.collection_remote
Expand Down
155 changes: 5 additions & 150 deletions playbooks/install_configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,9 @@
vars_files:
- "../vaults/{{ env }}.yml"
tasks:
- name: Include repository role
- name: Call dispatch role
ansible.builtin.include_role:
name: infra.ah_configuration.repository

- name: Include repository sync role
ansible.builtin.include_role:
name: infra.ah_configuration.repository_sync

- name: Publish custom collections
when: publish | default(false)
block:
- name: Include namespace role
ansible.builtin.include_role:
name: infra.ah_configuration.namespace

- name: Include publish role
ansible.builtin.include_role:
name: infra.ah_configuration.publish

- name: Include group role
ansible.builtin.include_role:
name: infra.ah_configuration.group
when: ah_groups | length is not match('0')

- name: Include user role
ansible.builtin.include_role:
name: infra.ah_configuration.user
when: ah_users | length is not match('0')
name: infra.eda_configuration.dispatch

- name: Configure ansible controller post installation
hosts: "{{ env | default('dev') }}" # noqa: syntax-check
Expand Down Expand Up @@ -80,38 +55,6 @@
controller_password: "{{ controller_password }}"
validate_certs: false

- name: Include setting role
ansible.builtin.include_role:
name: infra.controller_configuration.settings
when: controller_settings | length is not match('0')

- name: Include organization role
ansible.builtin.include_role:
name: infra.controller_configuration.organizations
vars:
assign_galaxy_credentials_to_org: false
assign_default_ee_to_org: false
when: controller_organizations | length is not match('0')

- name: Include labels role
ansible.builtin.include_role:
name: infra.controller_configuration.labels
when: controller_labels | length is not match('0')

- name: Include users role
ansible.builtin.include_role:
name: infra.controller_configuration.users
vars:
controller_configuration_users_secure_logging: true
when: controller_user_accounts | length is not match('0')

- name: Include teams role
ansible.builtin.include_role:
name: infra.controller_configuration.teams
when: controller_teams | length is not match('0')

# probably not good but kinda works, looking for better solutions,
# you are better off removing this block and getting token into vault by hand
- name: Figuring out AH token
when: ah_token is not defined or ah_token['token'] is defined
block:
Expand All @@ -120,106 +63,18 @@
ah_host: "{{ ah_host | default(groups['automationhub'][0]) }}"
ah_username: "{{ ah_token_username | default('admin') }}"
ah_password: "{{ ah_token_password }}"
ah_path_prefix: 'galaxy' # this is for private automation hub
ah_path_prefix: galaxy # this is for private automation hub
validate_certs: false
register: r_ah_token

- name: Fixing format
ansible.builtin.set_fact:
ah_token: "{{ ah_token['token'] }}"
when: r_ah_token['changed'] # noqa: no-handler
# what needs to be done to guarantee this to work?

- name: Include credential_types role
ansible.builtin.include_role:
name: infra.controller_configuration.credential_types
when: controller_credential_types | length is not match('0')

- name: Include credential role
ansible.builtin.include_role:
name: infra.controller_configuration.credentials
vars:
controller_configuration_credentials_secure_logging: true
when: controller_credentials | length is not match('0')

- name: Include credential_input_sources role
ansible.builtin.include_role:
name: infra.controller_configuration.credential_input_sources
when: controller_credential_input_sources | length is not match('0')

- name: Include instance_groups role
ansible.builtin.include_role:
name: infra.controller_configuration.instance_groups
when: controller_instance_groups | length is not match('0')

- name: Include execution_environments role
ansible.builtin.include_role:
name: infra.controller_configuration.execution_environments
when: controller_execution_environments | length is not match('0')

- name: Include organizations role
ansible.builtin.include_role:
name: infra.controller_configuration.organizations
when: controller_organizations | length is not match('0')

- name: Include Notification role
ansible.builtin.include_role:
name: infra.controller_configuration.notification_templates
when: controller_notifications | length is not match('0')

- name: Include projects role
ansible.builtin.include_role:
name: infra.controller_configuration.projects
when: controller_projects | length is not match('0')

- name: Include inventories role
ansible.builtin.include_role:
name: infra.controller_configuration.inventories
when: controller_inventories | length is not match('0')

- name: Include inventory_sources role
ansible.builtin.include_role:
name: infra.controller_configuration.inventory_sources
when: controller_inventory_sources | length is not match('0')

- name: Include inventory_source_update role
ansible.builtin.include_role:
name: infra.controller_configuration.inventory_source_update

- name: Include groups role
ansible.builtin.include_role:
name: infra.controller_configuration.groups
when: controller_groups | length is not match('0')

- name: Include hosts role
ansible.builtin.include_role:
name: infra.controller_configuration.hosts
when: controller_hosts | length is not match('0')

- name: Include applications role
ansible.builtin.include_role:
name: infra.controller_configuration.applications
when: controller_applications | length is not match('0')

- name: Include job_templates role
ansible.builtin.include_role:
name: infra.controller_configuration.job_templates
when: controller_templates | length is not match('0')

- name: Include workflow_job_templates role
ansible.builtin.include_role:
name: infra.controller_configuration.workflow_job_templates
when: controller_workflows | length is not match('0')

- name: Include schedules role
ansible.builtin.include_role:
name: infra.controller_configuration.schedules
when: controller_schedules | length is not match('0')

- name: Include roles role
- name: Call dispatch role
ansible.builtin.include_role:
name: infra.controller_configuration.roles
when: controller_roles | length is not match('0')
name: infra.controller_configuration.dispatch

- name: Launch build execution environment job template
awx.awx.job_launch:
Expand Down

0 comments on commit b7ae02f

Please sign in to comment.