From 58f18d68d29aa19044c3695bd7d8169060dc9e33 Mon Sep 17 00:00:00 2001 From: David Danielsson Date: Thu, 11 Apr 2024 14:52:38 -0500 Subject: [PATCH] modified: collections/requirements.yml modified: group_vars/all/auth.yml new file: group_vars/all/eda_credentials.yml new file: group_vars/all/eda_decision_environments.yml new file: group_vars/all/eda_projects.yml new file: group_vars/all/eda_rulebook_activations.yml modified: group_vars/all/job_templates.yml new file: playbooks/eda_config.yml --- collections/requirements.yml | 1 + group_vars/all/auth.yml | 14 ++++++--- group_vars/all/eda_credentials.yml | 8 +++++ group_vars/all/eda_decision_environments.yml | 7 +++++ group_vars/all/eda_projects.yml | 10 ++++++ group_vars/all/eda_rulebook_activations.yml | 14 +++++++++ group_vars/all/job_templates.yml | 13 ++++++++ playbooks/eda_config.yml | 33 ++++++++++++++++++++ 8 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 group_vars/all/eda_credentials.yml create mode 100644 group_vars/all/eda_decision_environments.yml create mode 100644 group_vars/all/eda_projects.yml create mode 100644 group_vars/all/eda_rulebook_activations.yml create mode 100644 playbooks/eda_config.yml diff --git a/collections/requirements.yml b/collections/requirements.yml index ddac692..ecdf3de 100644 --- a/collections/requirements.yml +++ b/collections/requirements.yml @@ -8,4 +8,5 @@ collections: # Commented out until CI/CD can get fixed # - name: ansible.controller - name: awx.awx + - name: infra.eda_configuration ... diff --git a/group_vars/all/auth.yml b/group_vars/all/auth.yml index 01c1790..6c8c3bf 100644 --- a/group_vars/all/auth.yml +++ b/group_vars/all/auth.yml @@ -1,17 +1,23 @@ # User may add controller auth creds to this file and encrypt it using `ansible-vault` --- -controller_hostname: "{{ controller_host | default(groups['automationcontroller'][0]) }}" +controller_hostname: "{{ controller_host | default(groups['automationcontroller'][0]) }}:{{ controller_port | default(443) }}" controller_username: "{{ controller_user | default('admin') }}" controller_password: "{{ controller_pass }}" controller_validate_certs: false -ah_host: "{{ ah_hostname | default(groups['automationhub'][0]) }}" +ah_host: "{{ ah_hostname | default(groups['automationhub'][0]) }}:{{ ah_port | default(443) }}" ah_username: "{{ ah_user | default('admin') }}" ah_password: "{{ ah_pass }}" -ah_path_prefix: galaxy # this is for private automation hub -validate_certs: false +ah_path_prefix: 'galaxy' # this is for private automation hub +ah_verify_ssl: false +ah_validate_certs: false ee_registry_username: "{{ ah_username }}" ee_registry_password: "{{ ah_password }}" ee_registry_dest: "{{ ah_host }}" + +eda_hostname: "{{ eda_host | default(groups['automationedacontroller'][0]) | default(groups['automationeda'][0]) }}:{{ eda_port | default(443) }}" +eda_username: "{{ eda_user | default('admin') }}" +eda_password: "{{ eda_pass }}" +eda_validate_certs: false ... diff --git a/group_vars/all/eda_credentials.yml b/group_vars/all/eda_credentials.yml new file mode 100644 index 0000000..2e80b61 --- /dev/null +++ b/group_vars/all/eda_credentials.yml @@ -0,0 +1,8 @@ +--- +eda_credentials: + - name: hub + description: private automation hub + credential_type: 'Container Registry' + username: "{{ ah_username }}" + secret: "{{ ah_password }}" +... diff --git a/group_vars/all/eda_decision_environments.yml b/group_vars/all/eda_decision_environments.yml new file mode 100644 index 0000000..7190093 --- /dev/null +++ b/group_vars/all/eda_decision_environments.yml @@ -0,0 +1,7 @@ +--- +eda_decision_environments: + - name: minimal + description: my default decision environment + image_url: "{{ ah_host }}/de-minimal-rhel8" + credential: hub +... diff --git a/group_vars/all/eda_projects.yml b/group_vars/all/eda_projects.yml new file mode 100644 index 0000000..8efec44 --- /dev/null +++ b/group_vars/all/eda_projects.yml @@ -0,0 +1,10 @@ +--- +eda_projects: + - name: eda + description: config as code eda + url: https://github.com/djdanielsson/eda.git + # credential: test_token + wait: true + interval: 10 + sync: true +... diff --git a/group_vars/all/eda_rulebook_activations.yml b/group_vars/all/eda_rulebook_activations.yml new file mode 100644 index 0000000..92f5784 --- /dev/null +++ b/group_vars/all/eda_rulebook_activations.yml @@ -0,0 +1,14 @@ +--- +eda_rulebook_activations: + - name: gitea_hook + description: Hook to listen for changes in gitea + project: eda + rulebook: config_as_code.yml + decision_environment: minimal + # extra_vars: + # provider: github-local + # repo_url: https://github.com/ansible/ansible-rulebook.git + enabled: true + state: present + awx_token: aap +... diff --git a/group_vars/all/job_templates.yml b/group_vars/all/job_templates.yml index b61f2b1..acd3fd6 100644 --- a/group_vars/all/job_templates.yml +++ b/group_vars/all/job_templates.yml @@ -31,6 +31,19 @@ controller_templates_all: - ah_token_user - vault + - name: eda_config + project: config_as_code + job_type: run + playbook: playbooks/eda_config.yml + inventory: config_as_code + execution_environment: supported + concurrent_jobs_enabled: false + ask_variables_on_launch: true + limit: "{{ env }}" + verbosity: 0 + credentials: + - vault + - name: build_execution_environments project: config_as_code job_type: run diff --git a/playbooks/eda_config.yml b/playbooks/eda_config.yml new file mode 100644 index 0000000..3ce9b3d --- /dev/null +++ b/playbooks/eda_config.yml @@ -0,0 +1,33 @@ +--- +- name: Playbook to configure event driven ansible controller post installation + hosts: all + vars_files: + - "../vaults/{{ env }}.yml" + connection: local + tasks: + - name: Include credential 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 + +...