Skip to content

Commit 79fa4ab

Browse files
authored
Merge pull request #66 from bgraef/main
add olam cluster code
2 parents 2b241b9 + 902d652 commit 79fa4ab

File tree

8 files changed

+686
-6
lines changed

8 files changed

+686
-6
lines changed

olam/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,40 @@
112112
ansible_host: "{{ instance_public_ip }}"
113113
ansible_port: 22
114114
instance_ocid: "{{ instance_id }}"
115+
116+
- name: Create host ini file
117+
ansible.builtin.lineinfile:
118+
path: hosts
119+
regexp: '^\[{{ host_group }}'
120+
line: "[{{ host_group }}]"
121+
create: true
122+
mode: "0664"
123+
delegate_to: localhost
124+
loop:
125+
- control
126+
- execution
127+
- db
128+
loop_control:
129+
loop_var: host_group
130+
131+
- name: Add host to ini host file
132+
ansible.builtin.lineinfile:
133+
path: hosts
134+
regexp: '^{{ instance_name }}'
135+
line: >-
136+
{{ instance_name }}
137+
ansible_host={{ instance_ansible_host }}
138+
ansible_user={{ instance_ansible_user }}
139+
ansible_private_key_file={{ instance_ansible_private_key_file }}
140+
ansible_ssh_common_args={{ instance_ansible_ssh_common_args | quote }}
141+
insertafter: '^\[{{ item.value.type }}\]$'
142+
create: true
143+
mode: "664"
144+
delegate_to: localhost
145+
vars:
146+
instance_name: "{{ instance_display_name }}"
147+
instance_ansible_user: opc
148+
instance_ansible_private_key_file: "{{ lookup('env', 'HOME') + '/.ssh/' + private_key }}"
149+
instance_ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
150+
instance_ansible_host: "{{ instance_public_ip }}"
151+
instance_ansible_port: 22

olam/convert_ansible_inventory.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
3+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
4+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
5+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
6+
# See LICENSE.TXT for details.
7+
8+
# Check if input file is provided
9+
if [ $# -ne 1 ]; then
10+
echo "Usage: $0 <input_file>"
11+
exit 1
12+
fi
13+
14+
# Set input file
15+
input_file="$1"
16+
17+
# Check if input file exists
18+
if [ ! -f "$input_file" ]; then
19+
echo "Error: Input file '$input_file' does not exist."
20+
exit 1
21+
fi
22+
23+
# Extract hosts and create new format
24+
echo "[control]"
25+
grep "^olam-control-" "$input_file" | sed -E "s/ (ansible_user=opc|ansible_private_key_file=[^ ]+|ansible_ssh_common_args='[^']+')//g" | awk '{print $1, $2, $3}' | sort
26+
echo ""
27+
28+
echo "[control:vars]"
29+
echo "node_type=control"
30+
echo "peers=local_execution_group"
31+
echo ""
32+
33+
echo "[execution]"
34+
grep -E "^olam-(execution|hop|remote-execution)-" "$input_file" | sed -E "s/ (ansible_user=opc|ansible_private_key_file=[^ ]+|ansible_ssh_common_args='[^']+')//g" | awk '{print $1, $2, $3}' | sort
35+
echo ""
36+
37+
echo "[local_execution_group]"
38+
grep "^olam-execution-" "$input_file" | sed -E "s/ (ansible_user=opc|ansible_private_key_file=[^ ]+|ansible_ssh_common_args='[^']+')//g" | awk '{print $1, $2, $3}' | sort
39+
echo ""
40+
41+
echo "[local_execution_group:vars]"
42+
echo "node_type=execution"
43+
echo ""
44+
45+
echo "[hop]"
46+
grep "^olam-hop-" "$input_file" | sed -E "s/ (ansible_user=opc|ansible_private_key_file=[^ ]+|ansible_ssh_common_args='[^']+')//g" | awk '{print $1, $2, $3}'
47+
echo ""
48+
49+
echo "[hop:vars]"
50+
echo "peers=control"
51+
echo ""
52+
53+
echo "[remote_execution_group]"
54+
grep "^olam-remote-execution-" "$input_file" | sed -E "s/ (ansible_user=opc|ansible_private_key_file=[^ ]+|ansible_ssh_common_args='[^']+')//g" | awk '{print $1, $2, $3}'
55+
echo ""
56+
57+
echo "[remote_execution_group:vars]"
58+
echo "peers=hop"
59+
echo ""
60+
61+
echo "[db]"
62+
grep "^olam-db" "$input_file" | sed -E "s/ (ansible_user=opc|ansible_private_key_file=[^ ]+|ansible_ssh_common_args='[^']+')//g" | awk '{print $1, $2, $3}'
63+
echo ""
64+
65+
echo "[all:vars]"
66+
echo "ansible_user=opc"
67+
echo "ansible_private_key_file=/home/luna.user/.ssh/id_rsa"
68+
echo "ansible_ssh_common_args='-o StrictHostKeyChecking=no'"

olam/default_vars.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ instance_shape: "VM.Standard.E4.Flex"
99
instance_ocpus: 2
1010
instance_memory: 32
1111
subnet_cidr_block: "10.0.0.48/28"
12+
private_key: "id_rsa"
1213

1314
username: "oracle"
1415
usergroup: "{{ username }}"
@@ -43,4 +44,20 @@ vm_vcpus: 2
4344
vm_ram_mb: 2048
4445
vm_net: default
4546
vm_root_pass:
46-
cleanup_tmp: no
47+
cleanup_tmp: no
48+
49+
awx_pguser_password: password
50+
olam_admin_password: admin
51+
52+
# Set proxy if needed
53+
# Uncomment both the pip_proxy_env and proxy_env sections, and set the proxy host and port accordingly.
54+
55+
pip_proxy_env:
56+
# http_proxy: 'http://www.example.com:80
57+
# https_proxy: 'https://www.example.com:80'
58+
59+
proxy_env:
60+
# http_proxy: 'www.example.com:80'
61+
# https_proxy: 'www.example.com:80'
62+
# ftp_proxy: 'www.example.com:80'
63+
# no_proxy: 'localhost,127.0.0.1,example.com'

0 commit comments

Comments
 (0)