-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(consul): added consul vms, changed rocky linux template
- Loading branch information
Showing
9 changed files
with
99 additions
and
4 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
virt-clone --original rocky9 --name basevm -f /data/vms/templates/basevm.qcow2 | ||
w=$(virt-sysprep --list-operations | egrep -v 'fs-uuids|lvm-uuids|ssh-userdir|ssh-hostkeys|bash-history' | awk '{ printf "%s,", $1}' | sed 's/,$//') | ||
virt-sysprep -d basevm --hostname basevm --enable $w | ||
#cp /data/vms/basevm.qcow2 /data/templates/basevm.qcow2 | ||
cp /data/vms/basevm.qcow2 /data/templates/basevm.qcow2 | ||
#virsh dumpxml basevm > /data/vms/templates/basevm.xml | ||
virsh undefine basevm |
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 @@ | ||
../../../99_newhost/ansible/01_prepare_nodes.yaml |
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,45 @@ | ||
--- | ||
- hosts: localhost | ||
become: true | ||
gather_facts: no | ||
tasks: | ||
|
||
- name: Set variables | ||
include: include/_setup_vars.yaml | ||
|
||
- name: Create snapshot for the host | ||
shell: virsh snapshot-create-as --domain {{ fqdn }} --name "before Consul installation" | ||
ignore_errors: yes | ||
|
||
- name: "Create ansible group for new hosts" | ||
add_host: name="{{ ip }}" groups=newhost | ||
|
||
|
||
- hosts: newhost | ||
become: true | ||
gather_facts: no | ||
tasks: | ||
|
||
|
||
- name: Set variables | ||
include: include/_setup_vars.yaml | ||
|
||
- name: Install yum utils | ||
shell: yum install -y yum-utils | ||
|
||
- name: Add hashicorp repo | ||
shell: yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo | ||
|
||
- name: Install consul and envoy | ||
shell: yum install -y consul hashicorp-envoy | ||
|
||
- name: Copy consul bootstrap file | ||
copy: | ||
src: include/consul.hcl | ||
dest: /etc/consul.d/consul.hcl | ||
|
||
- name: Enable consul agent and start it | ||
shell: systemctl enable consul ; systemctl start consul | ||
|
||
- name: Add ui port | ||
shell: firewall-cmd --add-port=8080/tcp --permanent ; firewall-cmd --reload |
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,37 @@ | ||
- name: Set global variables | ||
set_fact: | ||
virbr: "8" | ||
netsuffix: "254" | ||
hostname: "apigw" | ||
domain: "lab.syscallx86.com" | ||
mem: "2G" | ||
ipaserver: "freeipa.lab.syscallx86.com" | ||
nfsserver: "nfsnode.lab.syscallx86.com" | ||
home_export: "/nfsvg/home" | ||
ipaip: "10.1.8.10" | ||
ldapbase: "dc=lab,dc=local" | ||
svcadmin: "admin" | ||
adminpwd: "admin123" | ||
template: "basevm" | ||
template_dir: "/data/templates" | ||
vms_dir: "/data/vms" | ||
rootvg_size: 30 | ||
|
||
|
||
- name: Set ip | ||
set_fact: | ||
ip: "10.1.{{ virbr }}.{{ netsuffix }}" | ||
|
||
|
||
|
||
- name: Set FQDN | ||
set_fact: | ||
fqdn: "{{ hostname }}.{{ domain }}" | ||
|
||
- name: Set REALM | ||
set_fact: | ||
realm: "{{ domain|upper }}" | ||
|
||
- name: Set disksize | ||
set_fact: | ||
disksize: "30" |
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,6 @@ | ||
data_dir = "/opt/consul" | ||
client_addr = "0.0.0.0" | ||
retry_join = ["10.1.8.26"] # Adresa vašeho Consul serveru | ||
enable_central_service_config = true | ||
encrypt = "5idcXNSN1IESUpVGNBVsqDfEMc0HbX5hDa3I5ld5uMg=" | ||
datacenter = "primary" |
Empty file.
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