Skip to content

Commit deb5643

Browse files
authored
Merge pull request #47 from bgraef/main
add olam pah code
2 parents 0316d3a + addb6d8 commit deb5643

11 files changed

+178
-29
lines changed

olam/create_instance.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
+ groups['server']|default([])
311311
312312
- name: Configure passwordless SSH
313-
ansible.builtin.include_tasks: "olam_passwordless_setup.yml"
313+
ansible.builtin.include_tasks: "passwordless_setup.yml"
314314
when: passwordless_ssh
315315

316316
- name: Install Oracle Linux Automation Engine
@@ -346,6 +346,14 @@
346346
ansible.builtin.import_playbook: provision_kvm.yml
347347
when: use_kvm
348348

349+
- name: Provision Oracle Linux Automation Builder Utility
350+
ansible.builtin.import_playbook: provision_builder.yml
351+
when: use_olam_builder
352+
353+
- name: Provision Oracle Linux Private Automation Hub
354+
ansible.builtin.import_playbook: provision_pah.yml
355+
when: use_olam_pah
356+
349357
- name: Print instances
350358
hosts: all
351359
become: true

olam/default_vars.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ update_all: false
2222
passwordless_ssh: true
2323
olam_single_host: false
2424
use_olae_only: false
25+
use_olam_builder: false
26+
use_olam_pah: false
2527
use_freeipa: false
2628
use_git: false
2729

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,53 @@
11
---
2-
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
33
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
44
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
55
# See LICENSE.TXT for details.
66

7-
- name: Generate ssh keypair for ol-control-node
7+
- name: Generate ssh keypair for user
88
community.crypto.openssh_keypair:
99
path: ~/.ssh/id_rsa
1010
size: 2048
11-
comment: olam ssh keypair
11+
comment: ol ssh keypair
1212
become: true
1313
become_user: "{{ username }}"
14-
when: inventory_hostname in groups['control']|default([])
1514

16-
- name: Fetch public key file from ol-control-node
15+
- name: Fetch public key file from server
1716
ansible.builtin.fetch:
1817
src: "~/.ssh/id_rsa.pub"
1918
dest: "buffer/{{ inventory_hostname }}-id_rsa.pub"
2019
flat: true
2120
become: true
2221
become_user: "{{ username }}"
23-
when: inventory_hostname in groups['control']|default([])
2422

25-
- name: Copy public key to ol-host
23+
- name: Copy public key to each destination
2624
ansible.posix.authorized_key:
27-
user: opc
25+
user: "{{ username }}"
2826
state: present
2927
key: "{{ lookup('file', 'buffer/{{ item }}-id_rsa.pub') }}"
30-
loop: "{{ groups['control'] | flatten(levels=1) }}"
28+
loop: "{{ groups['all'] | flatten(levels=1) }}"
3129
become: true
32-
when:
33-
- "'remote' in groups"
34-
- inventory_hostname in groups['remote']|default([])
3530

3631
- name: Print hostvars for groups
3732
ansible.builtin.debug:
3833
msg: "{{ hostvars[item] }}"
3934
loop: "{{ groups['all'] | flatten(levels=1) }}"
4035
when: debug_enabled
4136

37+
- name: Print vnc subnet_domain_name
38+
ansible.builtin.debug:
39+
var: my_subnet_domain_name
40+
when: debug_enabled
41+
4242
- name: Accept new ssh fingerprints
4343
ansible.builtin.shell: |
4444
ssh-keyscan -t ecdsa-sha2-nistp256 \
4545
{{ hostvars[item].ansible_hostname }},\
4646
{{ hostvars[item].ansible_default_ipv4.address }},\
4747
{{ hostvars[item].ansible_hostname + '.' + my_subnet_domain_name }} >> ~/.ssh/known_hosts
4848
with_items:
49-
- "{{ groups['remote'] }}"
49+
- "{{ groups['all'] }}"
5050
become: true
5151
become_user: "{{ username }}"
5252
register: result
5353
changed_when: result.rc == 0
54-
when:
55-
- "'remote' in groups"
56-
- inventory_hostname in groups['control']|default([])

olam/provision_builder.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
hosts: devops-node
99
become: true
1010

11-
vars:
12-
debug_enabled: false
11+
vars_files:
12+
- default_vars.yml
1313

1414
tasks:
1515

@@ -48,14 +48,16 @@
4848

4949
- name: Install Oracle Linux Automation Manager Builder Utility
5050
ansible.builtin.dnf:
51-
name: python39-ansible-builder
51+
name:
52+
- python3.11-ansible-builder
53+
- python3.11-pip
5254
state: present
5355
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
5456

5557
- name: Install Ansible Runner using pip
5658
ansible.builtin.pip:
5759
name: ansible-runner
58-
executable: pip3.9
60+
executable: pip3.11
5961

6062
- name: Create project directory
6163
ansible.builtin.file:
@@ -67,16 +69,16 @@
6769

6870
- name: Create execution-environment.yml
6971
ansible.builtin.template:
70-
src: templates/execution-environment.yml.j2
72+
src: templates/execution_environment.yml.j2
7173
dest: ~/my_custom_ee_project/execution-environment.yml
7274
mode: '0644'
7375
become: true
7476
become_user: "{{ username }}"
7577

7678
- name: Create ansible.cfg
77-
ansible.builtin.template:
78-
src: templates/ansible.cfg.j2
79-
dest: ~/my_custom_ee_project/ansible.cfg
79+
ansible.builtin.file:
80+
path: ~/my_custom_ee_project/ansible.cfg
81+
state: touch
8082
mode: '0644'
8183
become: true
8284
become_user: "{{ username }}"
@@ -97,10 +99,10 @@
9799
become: true
98100
become_user: "{{ username }}"
99101

100-
- name: Create bomdep.txt
101-
ansible.builtin.template:
102-
src: templates/bindep.txt.j2
103-
dest: ~/my_custom_ee_project/bindep.txt
102+
- name: Create bindep.txt
103+
ansible.builtin.file:
104+
path: ~/my_custom_ee_project/bindep.txt
105+
state: touch
104106
mode: '0644'
105107
become: true
106108
become_user: "{{ username }}"

olam/provision_pah.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
# Copyright (c) 2025 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
- name: Configure Private Automation Hub
8+
hosts: ol-pah
9+
become: true
10+
11+
vars_files:
12+
- default_vars.yml
13+
14+
tasks:
15+
16+
- name: Install Oracle Linux Automation Manager repository
17+
ansible.builtin.dnf:
18+
name: oraclelinux-automation-manager-release-el8
19+
state: present
20+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
21+
22+
- name: Disable Oracle Linux Automation Manager 1.0 repository
23+
community.general.ini_file:
24+
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo"
25+
section: ol8_automation
26+
option: enabled
27+
value: "0"
28+
mode: '0644'
29+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
30+
31+
- name: Disable Oracle Linux Automation Manager 2.0 repository
32+
community.general.ini_file:
33+
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo"
34+
section: ol8_automation2
35+
option: enabled
36+
value: "0"
37+
mode: '0644'
38+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
39+
40+
- name: Enable Oracle Linux Automation Manager 2.2 repository
41+
community.general.ini_file:
42+
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo"
43+
section: ol8_automation2.2
44+
option: enabled
45+
value: "1"
46+
mode: '0644'
47+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
48+
49+
- name: Install Oracle Linux Private Automation Hub
50+
ansible.builtin.dnf:
51+
name: ol-private-automation-hub-installer
52+
state: present
53+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
54+
55+
- name: Copy PAH playbook to home directory
56+
ansible.builtin.copy:
57+
src: /usr/share/ansible/collections/ansible_collections/oraclelinux/private_automation_hub/playbooks/single-node/
58+
dest: ~/single_node
59+
remote_src: true
60+
mode: '0775'
61+
become: true
62+
become_user: "{{ username }}"
63+
64+
- name: Create playbook inventory file
65+
ansible.builtin.template:
66+
src: templates/hosts.j2
67+
dest: ~/single_node/hosts
68+
mode: '0644'
69+
become: true
70+
become_user: "{{ username }}"
71+
72+
# - name: Run PAH installer playbook
73+
# ansible.builtin.shell: |
74+
# ansible-playbook single-node-install.yml -i hosts -e "olpah_admin_password=password olpah_db_password=password"
75+
# become: true
76+
# become: "{{ username }}"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
version: 2
3+
4+
build_arg_defaults:
5+
ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: "--ignore-certs"
6+
7+
ansible_config: 'ansible.cfg'
8+
9+
dependencies:
10+
galaxy: requirements.yml
11+
python: requirements.txt
12+
system: bindep.txt
13+
14+
images:
15+
base_image:
16+
name: container-registry.oracle.com/oracle_linux_automation_manager/olam-ee:2.2
17+
builder_image:
18+
name: container-registry.oracle.com/oracle_linux_automation_manager/olam-builder:2.2
19+
20+
additional_build_steps:
21+
prepend: |
22+
RUN whoami
23+
RUN cat /etc/os-release
24+
append:
25+
- RUN echo This is a post-install command!
26+
- RUN ls -la /etc
27+

olam/templates/hosts.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
all:
2+
hosts:
3+
hub:
4+
ansible_host: ol-pah
5+
ansible_user: oracle

olam/templates/ingress_security_rules.j2

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,18 @@ instance_ingress_security_rules:
3737
destination_port_range:
3838
max: 636
3939
min: 636
40+
{% endif %}
41+
{% if use_olam_pah %}
42+
- source: "10.0.0.0/24"
43+
protocol: 6
44+
tcp_options:
45+
destination_port_range:
46+
max: 80
47+
min: 80
48+
- source: "10.0.0.0/24"
49+
protocol: 6
50+
tcp_options:
51+
destination_port_range:
52+
max: 443
53+
min: 443
4054
{% endif %}

olam/templates/playbook.yml.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: get namespace name
3+
hosts: localhost
4+
tasks:
5+
- name: get namespace
6+
oracle.oci.oci_object_storage_namespace_facts:
7+
register: output
8+
- name: print namespace
9+
debug:
10+
msg: {% raw %} "{{ output }}" {% endraw %}

olam/templates/requirements.txt.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
setuptools
2+
oci>=2.141.1

0 commit comments

Comments
 (0)