generated from oracle-devrel/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from bgraef/main
add olam-builder code
- Loading branch information
Showing
3 changed files
with
165 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
--- | ||
# Copyright (c) 2025 Oracle and/or its affiliates. | ||
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0. | ||
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl) | ||
# See LICENSE.TXT for details. | ||
|
||
- name: Configure ansible control node | ||
hosts: devops-node | ||
become: true | ||
|
||
vars: | ||
debug_enabled: false | ||
|
||
tasks: | ||
|
||
- name: Install Oracle Linux Automation Manager repository | ||
ansible.builtin.dnf: | ||
name: oraclelinux-automation-manager-release-el8 | ||
state: present | ||
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8' | ||
|
||
- name: Disable Oracle Linux Automation Manager 1.0 repository | ||
community.general.ini_file: | ||
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo" | ||
section: ol8_automation | ||
option: enabled | ||
value: "0" | ||
mode: '0644' | ||
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8' | ||
|
||
- name: Disable Oracle Linux Automation Manager 2.0 repository | ||
community.general.ini_file: | ||
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo" | ||
section: ol8_automation2 | ||
option: enabled | ||
value: "0" | ||
mode: '0644' | ||
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8' | ||
|
||
- name: Enable Oracle Linux Automation Manager 2.2 repository | ||
community.general.ini_file: | ||
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo" | ||
section: ol8_automation2.2 | ||
option: enabled | ||
value: "1" | ||
mode: '0644' | ||
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8' | ||
|
||
- name: Install Oracle Linux Automation Manager Builder Utility | ||
ansible.builtin.dnf: | ||
name: python39-ansible-builder | ||
state: present | ||
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8' | ||
|
||
- name: Install Ansible Runner using pip | ||
ansible.builtin.pip: | ||
name: ansible-runner | ||
executable: pip3.9 | ||
|
||
- name: Create project directory | ||
ansible.builtin.file: | ||
path: ~/my_custom_ee_project | ||
state: directory | ||
mode: '0775' | ||
become: true | ||
become_user: "{{ username }}" | ||
|
||
- name: Create execution-environment.yml | ||
ansible.builtin.template: | ||
src: templates/execution-environment.yml.j2 | ||
dest: ~/my_custom_ee_project/execution-environment.yml | ||
mode: '0644' | ||
become: true | ||
become_user: "{{ username }}" | ||
|
||
- name: Create ansible.cfg | ||
ansible.builtin.template: | ||
src: templates/ansible.cfg.j2 | ||
dest: ~/my_custom_ee_project/ansible.cfg | ||
mode: '0644' | ||
become: true | ||
become_user: "{{ username }}" | ||
|
||
- name: Create requirements.yml | ||
ansible.builtin.template: | ||
src: templates/requirements.yml.j2 | ||
dest: ~/my_custom_ee_project/requirements.yml | ||
mode: '0644' | ||
become: true | ||
become_user: "{{ username }}" | ||
|
||
- name: Create requirements.txt | ||
ansible.builtin.template: | ||
src: templates/requirements.txt.j2 | ||
dest: ~/my_custom_ee_project/requirements.txt | ||
mode: '0644' | ||
become: true | ||
become_user: "{{ username }}" | ||
|
||
- name: Create bomdep.txt | ||
ansible.builtin.template: | ||
src: templates/bindep.txt.j2 | ||
dest: ~/my_custom_ee_project/bindep.txt | ||
mode: '0644' | ||
become: true | ||
become_user: "{{ username }}" | ||
|
||
- name: Create custom execution environment image | ||
ansible.builtin.shell: | | ||
cd ~/my_custom_ee_project | ||
ansible-builder build --tag my_custom_ee -v 3 | ||
become: true | ||
become_user: "{{ username }}" | ||
register: builder_output | ||
changed_when: builder_output.rc != 0 | ||
|
||
- name: Print the Builder results | ||
ansible.builtin.debug: | ||
msg: "{{ builder_output.stdout }}" | ||
when: debug_enabled | ||
|
||
- name: Create runner private_data_dir | ||
ansible.builtin.file: | ||
path: /tmp/private/project | ||
state: directory | ||
mode: '0775' | ||
become: true | ||
become_user: "{{ username }}" | ||
|
||
- name: Create playbook | ||
ansible.builtin.template: | ||
src: templates/playbook.yml.j2 | ||
dest: /tmp/private/project/playbook.yml | ||
mode: '0644' | ||
become: true | ||
become_user: "{{ username }}" | ||
|
||
# - name: Test custom ee | ||
# ansible.builtin.command: ansible-runner run --process-isolation --container-image=my_custom_ee -p playbook.yml /tmp/private | ||
# become_user: "{{ username }}" | ||
# register: runner_output | ||
|
||
# - name: Print runner results | ||
# ansible.builtin.debug: | ||
# msg: "{{ runner_output.stdout }}" | ||
# when: debug_enabled |