Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #70 from mandoonandy/master
Browse files Browse the repository at this point in the history
Setup KSM on all nodes
  • Loading branch information
mikalstill committed Sep 20, 2020
2 parents 36e72c6 + 7c47812 commit 472d573
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 41 deletions.
37 changes: 17 additions & 20 deletions ansible/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
tasks:
- include: terraform/{{cloud}}/postboot.yml

- hosts: db
- hosts: primary
any_errors_fatal: true
become: yes
become_method: sudo
Expand All @@ -82,6 +82,14 @@
state: restarted
when: mode == "deploy"

- hosts: allsf
any_errors_fatal: true
become: yes
become_method: sudo
gather_facts: yes
connection: ssh

tasks:
- name: Configure KSM to run on boot
copy:
content: |
Expand Down Expand Up @@ -135,37 +143,26 @@
sysctl -w net.ipv6.conf.default.disable_ipv6=1
ignore_errors: True

- hosts: allsf
any_errors_fatal: true
become: yes
become_method: sudo
gather_facts: yes
connection: ssh
vars:
release: git
mode: deploy

tasks:
- name: Syslog server is DB server
- name: Syslog server is the primary server
set_fact:
syslog: "{{hostvars['localhost']['database_node_ip']}}"
syslog: "{{hostvars['localhost']['primary_node_ip']}}"
when: mode == "deploy"

- name: Send syslog to the DB server, unless I am the DB server
- name: Send syslog to the primary server, unless I am the primary server
template:
src: files/rsyslog-client-01-sf.conf
dest: /etc/rsyslog.d/01-sf.conf
owner: root
group: sudo
mode: u=r,g=r,o=
when: hostvars['localhost']['database_node_ip'] != node_ip and mode == "deploy"
when: hostvars['localhost']['primary_node_ip'] != node_ip and mode == "deploy"

- name: Restart syslog
service:
name: rsyslog
enabled: yes
state: restarted
when: hostvars['localhost']['database_node_ip'] != node_ip and mode == "deploy"
when: hostvars['localhost']['primary_node_ip'] != node_ip and mode == "deploy"

- name: Load default vars
include_vars: main.yml
Expand Down Expand Up @@ -333,7 +330,7 @@
mode: u=r,g=r,o=
when: mode == "deploy"

- hosts: db
- hosts: primary
any_errors_fatal: true
become: yes
become_method: sudo
Expand Down Expand Up @@ -546,7 +543,7 @@
state: restarted
daemon_reload: yes

- hosts: db
- hosts: primary
roles:
- role: andrewrothstein.terraform
terraform_binary_dir: /usr/local/bin/terraform_install
Expand All @@ -555,7 +552,7 @@
- role: andrewrothstein.go
when: mode == "deploy"

- hosts: db
- hosts: primary
any_errors_fatal: true
become: yes
become_method: sudo
Expand Down
4 changes: 2 additions & 2 deletions ansible/hosts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[local]
localhost ansible_connection=local

[db]
[primary]

[hypervisors]

[allsf:children]
db
primary
hypervisors

[allsf:vars]
Expand Down
2 changes: 1 addition & 1 deletion ansible/includes/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
upgrade: dist
autoremove: yes

- name: Install dependancies
- name: Install dependencies
apt:
name: "{{ shakenfist_deps }}"
state: latest
Expand Down
4 changes: 2 additions & 2 deletions ansible/terraform/aws-single-node/postboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
delegate_to: localhost
delegate_facts: true

- name: Determine database node
- name: Determine primary node
set_fact:
database_node_ip: "{{hostvars['sf-single']['node_ip']}}"
primary_node_ip: "{{hostvars['sf-single']['node_ip']}}"
delegate_to: localhost
delegate_facts: true
2 changes: 1 addition & 1 deletion ansible/terraform/aws-single-node/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ansible_ssh_host: "{{terraform_out.outputs.sf_single_external.value}}"
ansible_user: "ubuntu"
ansible_ssh_private_key_file: "~/.ssh/{{ssh_key_name}}.pem"
groups: hypervisors, db, etcd_master
groups: hypervisors, primary, etcd_master

- name: Add sf-single node_ip
set_fact:
Expand Down
4 changes: 2 additions & 2 deletions ansible/terraform/aws/postboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
delegate_to: localhost
delegate_facts: true

- name: Determine database node
- name: Determine primary node
set_fact:
database_node_ip: "{{hostvars['sf-1']['node_ip']}}"
primary_node_ip: "{{hostvars['sf-1']['node_ip']}}"
delegate_to: localhost
delegate_facts: true
2 changes: 1 addition & 1 deletion ansible/terraform/aws/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
ansible_ssh_host: "{{terraform_out.outputs.sf_1_external.value}}"
ansible_user: "ubuntu"
ansible_ssh_private_key_file: "~/.ssh/{{ssh_key_name}}.pem"
groups: hypervisors, db, etcd_master
groups: hypervisors, primary, etcd_master

- name: Add sf-1 node_ip
set_fact:
Expand Down
4 changes: 2 additions & 2 deletions ansible/terraform/gcp/postboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
delegate_to: localhost
delegate_facts: true

- name: Determine database node
- name: Determine primary node
set_fact:
database_node_ip: "{{hostvars['sf-1']['node_ip']}}"
primary_node_ip: "{{hostvars['sf-1']['node_ip']}}"
delegate_to: localhost
delegate_facts: true
2 changes: 1 addition & 1 deletion ansible/terraform/gcp/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
add_host:
hostname: sf-1
ansible_ssh_host: "{{terraform_out.outputs.sf_1_external.value[0]}}"
groups: hypervisors, db, etcd_master
groups: hypervisors, primary, etcd_master

- name: Add sf-1 node_ip
set_fact:
Expand Down
4 changes: 2 additions & 2 deletions ansible/terraform/metal/postboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
delegate_to: localhost
delegate_facts: true

- name: Determine database node
- name: Determine primary node
set_fact:
database_node_ip: "{{hostvars['sf-1']['node_ip']}}"
primary_node_ip: "{{hostvars['sf-1']['node_ip']}}"
delegate_to: localhost
delegate_facts: true
2 changes: 1 addition & 1 deletion ansible/terraform/metal/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
add_host:
hostname: sf-1
ansible_ssh_host: "{{metal_ip_sf1}}"
groups: hypervisors, db, etcd_master
groups: hypervisors, primary, etcd_master

- name: Add sf-1 node_ip
set_fact:
Expand Down
4 changes: 2 additions & 2 deletions ansible/terraform/openstack/postboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
delegate_to: localhost
delegate_facts: true

- name: Determine database node
- name: Determine primary node
set_fact:
database_node_ip: "{{hostvars['sf-1']['node_ip']}}"
primary_node_ip: "{{hostvars['sf-1']['node_ip']}}"
delegate_to: localhost
delegate_facts: true
2 changes: 1 addition & 1 deletion ansible/terraform/openstack/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
hostname: sf-1
ansible_ssh_host: "{{terraform_out.outputs.sf_1_external.value}}"
ansible_ssh_user: "ubuntu"
groups: hypervisors, db, etcd_master
groups: hypervisors, primary, etcd_master

- name: Add sf-1 node_ip
set_fact:
Expand Down
4 changes: 2 additions & 2 deletions ansible/terraform/shakenfist/postboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
delegate_to: localhost
delegate_facts: true

- name: Determine database node
- name: Determine primary node
set_fact:
database_node_ip: "{{hostvars['sf-1']['node_ip']}}"
primary_node_ip: "{{hostvars['sf-1']['node_ip']}}"
delegate_to: localhost
delegate_facts: true
2 changes: 1 addition & 1 deletion ansible/terraform/shakenfist/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
hostname: sf-1
ansible_ssh_host: "{{terraform_out.outputs.sf_1_external.value}}"
ansible_ssh_user: "ubuntu"
groups: hypervisors, db, etcd_master
groups: hypervisors, primary, etcd_master

- name: Add sf-1 node_ip
set_fact:
Expand Down

0 comments on commit 472d573

Please sign in to comment.