Skip to content

Commit c12af52

Browse files
committed
adjust vars for fqdn and add public rt to vlan
1 parent 357e16b commit c12af52

10 files changed

+35
-22
lines changed

olvm/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@
231231
path: hosts
232232
regexp: '^{{ instance_name }}'
233233
line: >-
234-
{{ instance_name }}
235-
ansible_host={{ instance_ansible_host }}
236-
ansible_user={{ instance_ansible_user }}
237-
ansible_private_key_file={{ instance_ansible_private_key_file }}
234+
{{ instance_name }}
235+
ansible_host={{ instance_ansible_host }}
236+
ansible_user={{ instance_ansible_user }}
237+
ansible_private_key_file={{ instance_ansible_private_key_file }}
238238
ansible_ssh_common_args={{ instance_ansible_ssh_common_args | quote }}
239239
insertafter: '^\[{{ item.value.type }}\]$'
240240
create: true

olvm/create_hostfile_secondary_nic.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
tasks:
1414

1515
- name: Get engine ip address # noqa: run-once[task]
16-
ansible.builtin.command: "dig vdsm.olvpriv.vcn.oraclevcn.com +short"
16+
ansible.builtin.command: "dig vdsm.{{ my_subnet2_domain_name }} +short"
1717
register: dns_ip
1818
changed_when: dns_ip.rc == 0
1919
delegate_to: "{{ groups['engine'][0] }}"
@@ -29,13 +29,13 @@
2929
ansible.builtin.lineinfile:
3030
dest: /etc/hosts
3131
regexp: "^.*vdsm.*$"
32-
line: "{{ dns_ip.stdout }} vdsm.olvpriv.vcn.oraclevcn.com vdsm"
32+
line: "{{ dns_ip.stdout }} vdsm.{{ my_subnet2_domain_name }} vdsm"
3333
delegate_to: "{{ item }}"
3434
loop: "{{ groups['all'] }}"
3535
become: true
3636

3737
- name: Get kvm host IP address # noqa: run-once[task]
38-
ansible.builtin.command: "dig vdsm{{ hostvars[item].inventory_hostname_short[-2:] }}.olvpriv.vcn.oraclevcn.com +short"
38+
ansible.builtin.command: "dig vdsm{{ hostvars[item].inventory_hostname_short[-2:] }}.{{ my_subnet2_domain_name }} +short"
3939
register: kvm_dns_ip
4040
loop: "{{ groups['kvm'] | flatten(levels=1) }}"
4141
changed_when: kvm_dns_ip.rc == 0

olvm/create_vlan.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
- "{{ my_l2_vlan_nsg_id }}"
4848
vcn_id: "{{ my_vcn_id }}"
4949
vlan_tag: 1
50+
route_table_id: "{{ my_public_rt_id }}"
5051
register: result
5152
retries: 10
5253
delay: 30

olvm/default_vars.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ vnc_port: "1"
3333
vnc_default_password: "{{ username }}"
3434
vnc_geometry: "1920x1080"
3535

36-
engine_fqdn: olvm.olvpub.vcn.oraclevcn.com
36+
engine_fqdn: olvm.pub.olv.oraclevcn.com
3737
engine_url: https://{{ engine_fqdn }}/ovirt-engine/api
3838
engine_user: admin@ovirt@internalsso
3939
engine_pass: How-2-install

olvm/ovirt_add_hosts.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
- name: Add KVM hosts to a Cluster in the Engine server
88
hosts: olvm
9-
109
vars_files:
1110
- default_vars.yml
11+
- oci_vars.yml
1212

1313
tasks:
1414

1515
- name: Download ca-cert
1616
ansible.builtin.get_url:
17-
url: "https://olvm.olvpub.vcn.oraclevcn.com/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA"
17+
url: "https://{{ engine_fqdn }}/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA"
1818
dest: "{{ ansible_env.HOME + '/pki-resource' }}"
1919
mode: '0664'
2020
validate_certs: false
@@ -27,15 +27,15 @@
2727
ca_file: "{{ ansible_env.HOME + '/pki-resource' }}"
2828
insecure: true
2929
when: ovirt_auth is undefined or not ovirt_auth
30-
register: connection
30+
register: auth_connection
3131
tags:
3232
- always
3333

3434
- name: Add KVM host
3535
ovirt.ovirt.ovirt_host:
3636
cluster: "Default"
3737
name: "olkvm0{{ ansible_loop.index0 + 1 }}"
38-
address: "vdsm0{{ ansible_loop.index0 + 1 }}.olvpriv.vcn.oraclevcn.com"
38+
address: "vdsm0{{ ansible_loop.index0 + 1 }}.{{ my_subnet2_domain_name }}"
3939
auth: "{{ ovirt_auth }}"
4040
timeout: 2200
4141
power_management_enabled: false
@@ -47,7 +47,7 @@
4747
register: kvm_sleeper
4848

4949
- name: Disconnect from the OLVM Engine application
50-
ovirt_auth:
50+
ovirt.ovirt.ovirt_auth:
5151
state: absent
5252
ovirt_auth: "{{ ovirt_auth }}"
5353
tags:

olvm/ovirt_connection_test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@
2727
ca_file: "{{ ansible_env.HOME + '/pki-resource' }}"
2828
insecure: true
2929
when: ovirt_auth is undefined or not ovirt_auth
30-
register: connection
30+
register: auth_connection
3131
tags:
3232
- always
3333

3434
- name: Show connection information
35-
debug:
36-
msg: "Connected to the OLVM Engine application at {{ connection.ansible_facts.ovirt_auth.url }}"
35+
ansible.builtin.debug:
36+
msg: "Connected to the OLVM Engine application at {{ auth_connection.ansible_facts.ovirt_auth.url }}"
3737

3838
- name: Disconnect from the OLVM Engine application
39-
ovirt_auth:
39+
ovirt.ovirt.ovirt_auth:
4040
state: absent
4141
ovirt_auth: "{{ ovirt_auth }}"
4242
tags:

olvm/ovirt_upload_image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
- name: Download ca-cert
1616
ansible.builtin.get_url:
17-
url: "https://olvm.olvpub.vcn.oraclevcn.com/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA"
17+
url: "https://{{ engine_fqdn }}/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA"
1818
dest: /tmp/pki-resource
1919
mode: '0664'
2020
validate_certs: false

olvm/provision_olvm_engine.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- name: Get Started with OLVM
88
hosts: all
9+
order: sorted
910
vars_files:
1011
- default_vars.yml
1112
- oci_vars.yml
@@ -78,6 +79,13 @@
7879
delegate_to: "{{ groups['engine'][0] }}"
7980
run_once: true
8081

82+
- name: Check if OLVM Eingine is installed # noqa: run-once[task]
83+
ansible.builtin.stat:
84+
path: "/etc/pki/ovirt-engine/keys/engine_id_rsa"
85+
register: olvm_engine_installed
86+
delegate_to: "{{ groups['engine'][0] }}"
87+
run_once: true
88+
8189
- name: Install OLVM Engine with defaults # noqa: run-once[task]
8290
ansible.builtin.expect:
8391
command: /bin/engine-setup --generate-answer=file --accept-defaults
@@ -90,16 +98,18 @@
9098
changed_when: result.rc == 0
9199
delegate_to: "{{ groups['engine'][0] }}"
92100
run_once: true
101+
when: not olvm_engine_installed.stat.exists
93102

94-
- name: Activate Cockpit web console on the KVM hosts
103+
- name: Activate Cockpit web console on the KVM hosts # noqa: run-once[task]
95104
ansible.builtin.systemd:
96105
state: started
97106
name: cockpit.socket
98107
enabled: true
99108
delegate_to: "{{ item }}"
100109
loop: "{{ groups['kvm'] }}"
110+
run_once: true
101111

102-
- name: Open firewall for cockpit and virsh on the KVM hosts
112+
- name: Open firewall for cockpit and virsh on the KVM hosts # noqa: run-once[task]
103113
ansible.posix.firewalld:
104114
zone: public
105115
service: "{{ item[0] }}"
@@ -108,3 +118,4 @@
108118
immediate: true
109119
delegate_to: "{{ item[1] }}"
110120
loop: "{{ ['libvirt', 'libvirt-tls', 'cockpit'] | product(groups['kvm']) | list }}"
121+
run_once: true

olvm/provision_olvm_engine_privatekey.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030
delegate_to: "{{ groups['engine'][0] }}"
3131
run_once: true
3232

33-
- name: Copy public key to each destination
33+
- name: Copy public key to each destination # noqa: run-once[task]
3434
ansible.posix.authorized_key:
3535
user: "root"
3636
state: present
3737
key: "{{ lookup('file', 'buffer/engine-key.pub') }}"
3838
delegate_to: "{{ item }}"
3939
loop: "{{ groups['kvm'] }}"
40+
run_once: true
4041

4142
- name: Download ol9 ova image # noqa: run-once[task]
4243
ansible.builtin.get_url:

olvm/templates/etc_hosts_kvm.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{% for i in kvm_dns_ip.results %}
2-
{{ i.stdout }} vdsm0{{ loop.index }}.olvpriv.vcn.oraclevcn.com vdsm0{{ loop.index }}
2+
{{ i.stdout }} vdsm0{{ loop.index }}.{{ my_subnet2_domain_name }} vdsm0{{ loop.index }}
33
{% endfor %}

0 commit comments

Comments
 (0)