-
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.
- Loading branch information
veldrane
committed
Nov 23, 2020
1 parent
c65410c
commit a2a8303
Showing
5 changed files
with
129 additions
and
0 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
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,52 @@ | ||
--- | ||
- hosts: localhost | ||
become: true | ||
gather_facts: no | ||
tasks: | ||
|
||
- name: Set variables | ||
include: include/_setup_vars.yaml | ||
|
||
- name: "Create ansible group for new hosts" | ||
add_host: name="{{ ip }}" groups=newhost | ||
|
||
- name: Create prometheus data disk | ||
shell: qemu-img create -f qcow2 {{ vms_dir }}/{{ fqdn }}/promvg.qcow2 {{ disksize }} | ||
|
||
- name: Attach disk to machine | ||
shell: virsh attach-disk {{ fqdn }} --source {{ vms_dir }}/{{ fqdn }}/promvg.qcow2 --target vdb --subdriver qcow2 --targetbus virtio --persistent | ||
|
||
- name: Autostart of the machine | ||
shell: virsh autostart {{ fqdn }} | ||
|
||
- hosts: newhost | ||
become: true | ||
gather_facts: no | ||
tasks: | ||
|
||
- name: Set variables | ||
include: include/_setup_vars.yaml | ||
|
||
- name: Setup firewall rules | ||
shell: firewall-cmd --permanent --add-port=9090-9094/tcp --add-port=443/tcp ; firewall-cmd --reload | ||
|
||
- name: LV extend /lv-var | ||
shell: lvresize /dev/rootvg/var -L+10G | ||
|
||
- name: Resize fs | ||
shell: resize2fs /dev/rootvg/var | ||
|
||
- name: Create datavg and logical volume | ||
shell: pvcreate /dev/vdb ; vgcreate promvg /dev/vdb ; lvcreate -n data -L50G promvg | ||
|
||
- name: Create fs | ||
shell: mkfs.ext4 /dev/promvg/data | ||
|
||
- name: make directory /prometheus/data | ||
shell: mkdir -p /prometheus/data | ||
|
||
- name: Add /prometheus/data to fstab | ||
shell: echo '/dev/mapper/promvg-data /prometheus/data ext4 noatime,nodiratime 1 2' >> /etc/fstab | ||
|
||
- name: Mount /prometheus/data | ||
shell: mount /prometheus/data |
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 @@ | ||
--- | ||
- hosts: localhost | ||
become: true | ||
gather_facts: no | ||
tasks: | ||
|
||
- name: Set variables | ||
include: include/_setup_vars.yaml | ||
|
||
- name: "Create ansible group for new hosts" | ||
add_host: name="{{ master }}" groups=newhost | ||
|
||
- hosts: newhost | ||
become: true | ||
gather_facts: no | ||
tasks: | ||
|
||
- name: Set variables | ||
include: include/_setup_vars.yaml | ||
|
||
- name: Copy cluster.ini | ||
shell: cp /root/gshipley/cluster.ini /root/gshipley/prometheus.ini | ||
|
||
- name: Add new hosts | ||
shell: echo "[new_nodes]" >> /root/gshipley/prometheus.ini ; echo "{{ fqdn }} openshift_node_group_name='node-config-prometheus'" >> /root/gshipley/prometheus.ini | ||
|
||
- name: Add section new nodes | ||
shell: cd /root/gshipley ; sed -i -E 's/nodes$/nodes\nnew_nodes/' prometheus.ini | ||
|
||
- name: Add host to ansible host | ||
shell: echo "{{ fqdn }}" >> /etc/ansible/hosts | ||
|
||
- name: setting up the node group | ||
shell: cd /root/gshipley ; ansible-playbook -i prometheus.ini openshift-ansible/playbooks/openshift-master/openshift_node_group.yml | ||
|
||
- name: Add new node to the cluster | ||
shell: cd /root/gshipley ; ansible-playbook -i prometheus.ini openshift-ansible/playbooks/openshift-node/scaleup.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
- name: Set global variables | ||
set_fact: | ||
virbr: "16" | ||
netsuffix: "33" | ||
hostname: "node33" | ||
domain: "lab.local" | ||
mem: "8G" | ||
ipaserver: "freeipa.lab.local" | ||
ipaip: "10.1.8.10" | ||
ldapbase: "dc=lab,dc=local" | ||
svcadmin: "admin" | ||
adminpwd: "admin123" | ||
template: "t_centos7" | ||
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: "51G" | ||
|
||
- name: Set ocp master | ||
set_fact: | ||
master: "node11.lab.local" |