Skip to content

Commit 1638abb

Browse files
authored
Merge pull request #80 from bgraef/main
add vnc for devops node for pah
2 parents 887e0e3 + 59a12b3 commit 1638abb

File tree

4 files changed

+134
-5
lines changed

4 files changed

+134
-5
lines changed

olam/create_instance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@
343343
ansible.builtin.import_playbook: provision_kvm.yml
344344
when: use_kvm
345345

346+
- name: Provision vnc server on devops node
347+
ansible.builtin.import_playbook: provision_vnc.yml
348+
when: use_devops_vnc
349+
346350
- name: Provision Oracle Linux Automation Builder Utility
347351
ansible.builtin.import_playbook: provision_builder.yml
348352
when: use_olam_builder

olam/default_vars.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ add_block_storage: false
1919
block_volume_size_in_gbs: 50
2020
block_count: 1
2121

22+
use_devops_vnc: false
23+
vnc_port: "1"
24+
vnc_default_password: "oracle"
25+
vnc_geometry: "1920x1080"
26+
2227
update_all: false
2328
passwordless_ssh: false
2429
olam_type: single

olam/provision_pah.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313

1414
tasks:
1515

16-
- name: Install Oracle Linux Automation Manager repository
16+
- name: Install Oracle Linux Automation Manager repository on OL8
1717
ansible.builtin.dnf:
1818
name: oraclelinux-automation-manager-release-el8
1919
state: present
2020
retries: 5
2121
delay: 10
2222
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
2323

24-
- name: Disable Oracle Linux Automation Manager 1.0 repository
24+
- name: Disable Oracle Linux Automation Manager 1.0 repository on OL8
2525
community.general.ini_file:
2626
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo"
2727
section: ol8_automation
@@ -30,7 +30,7 @@
3030
mode: '0644'
3131
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
3232

33-
- name: Disable Oracle Linux Automation Manager 2.0 repository
33+
- name: Disable Oracle Linux Automation Manager 2.0 repository on OL8
3434
community.general.ini_file:
3535
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo"
3636
section: ol8_automation2
@@ -39,23 +39,57 @@
3939
mode: '0644'
4040
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
4141

42-
- name: Enable Oracle Linux Automation Manager 2.2 repository
42+
- name: Disable Oracle Linux Automation Manager 2.2 repository on OL8
4343
community.general.ini_file:
4444
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo"
4545
section: ol8_automation2.2
4646
option: enabled
47+
value: "0"
48+
mode: '0644'
49+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
50+
51+
- name: Enable Oracle Linux Automation Manager 2.3 repository on OL8
52+
community.general.ini_file:
53+
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol8.repo"
54+
section: ol8_automation2.3
55+
option: enabled
4756
value: "1"
4857
mode: '0644'
4958
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
5059

51-
- name: Install Oracle Linux Private Automation Hub
60+
- name: Install Oracle Linux Private Automation Hub on OL8
5261
ansible.builtin.dnf:
5362
name: ol-private-automation-hub-installer
5463
state: present
5564
retries: 5
5665
delay: 10
5766
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '8'
5867

68+
- name: Install Oracle Linux Automation Manager repository on OL9
69+
ansible.builtin.dnf:
70+
name: oraclelinux-automation-manager-release-el9
71+
state: present
72+
retries: 5
73+
delay: 10
74+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '9'
75+
76+
- name: Enable Oracle Linux Automation Manager 2.3 repository on OL9
77+
community.general.ini_file:
78+
path: "/etc/yum.repos.d/oraclelinux-automation-manager-ol9.repo"
79+
section: ol8_automation2.3
80+
option: enabled
81+
value: "1"
82+
mode: '0644'
83+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '9'
84+
85+
- name: Install Oracle Linux Private Automation Hub on OL9
86+
ansible.builtin.dnf:
87+
name: ol-private-automation-hub-installer
88+
state: present
89+
retries: 5
90+
delay: 10
91+
when: ansible_distribution == 'OracleLinux' and ansible_distribution_major_version == '9'
92+
5993
- name: Copy PAH playbook to home directory
6094
ansible.builtin.copy:
6195
src: /usr/share/ansible/collections/ansible_collections/oraclelinux/private_automation_hub/playbooks/single-node/

olam/provision_vnc.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
# Copyright (c) 2024 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: Install VNC Server and GNOME Desktop
8+
hosts: devops-node
9+
become: true
10+
11+
vars_files:
12+
- default_vars.yml
13+
14+
tasks:
15+
16+
- name: Install the "Server with GUI" package group
17+
ansible.builtin.dnf:
18+
name: '@Server with GUI'
19+
state: present
20+
retries: 5
21+
delay: 10
22+
23+
- name: Installing the vnc package
24+
ansible.builtin.dnf:
25+
name:
26+
- tigervnc-server
27+
- tigervnc-server-module
28+
state: present
29+
retries: 5
30+
delay: 10
31+
32+
- name: Set systemd default boot target to graphical.target
33+
ansible.builtin.file:
34+
src: /usr/lib/systemd/system/graphical.target
35+
dest: /etc/systemd/system/default.target
36+
state: link
37+
38+
- name: Set vncserver systemd template
39+
ansible.builtin.copy:
40+
src: "/usr/lib/systemd/system/[email protected]"
41+
dest: "/etc/systemd/system/vncserver@:{{ vnc_port }}.service"
42+
remote_src: true
43+
mode: "0644"
44+
45+
- name: Assign username to vnc port
46+
ansible.builtin.lineinfile:
47+
path: /etc/tigervnc/vncserver.users
48+
line: ":{{ vnc_port }}={{ username }}"
49+
50+
- name: Set vnc geometry and session
51+
ansible.builtin.blockinfile:
52+
path: /etc/tigervnc/vncserver-config-defaults
53+
block: |
54+
session=gnome
55+
geometry={{ vnc_geometry }}
56+
57+
- name: Create .vnc directory for user
58+
ansible.builtin.file:
59+
path: /home/{{ username }}/.vnc
60+
state: directory
61+
mode: "0700"
62+
owner: "{{ username }}"
63+
group: "{{ username }}"
64+
65+
- name: Generate vnc password for the remote user
66+
ansible.builtin.shell: |
67+
set -o pipefail
68+
echo {{ vnc_default_password }} | vncpasswd -f > /home/{{ username }}/.vnc/passwd
69+
args:
70+
chdir: "/home/{{ username }}/.vnc"
71+
creates: "/home/{{ username }}/.vnc/passwd"
72+
executable: /bin/bash
73+
74+
- name: Change the permission to 600 for .vnc/passwd file
75+
ansible.builtin.file:
76+
path: "/home/{{ username }}/.vnc/passwd"
77+
owner: "{{ username }}"
78+
group: "{{ usergroup }}"
79+
mode: "0600"
80+
81+
- name: Start and enable the vnc service
82+
ansible.builtin.systemd:
83+
name: "vncserver@:{{ vnc_port }}.service"
84+
daemon_reload: true
85+
enabled: true
86+
state: started

0 commit comments

Comments
 (0)