Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing configuration options and fix ansible lint errors #22

Draft
wants to merge 10 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
target/*
target/*
6 changes: 6 additions & 0 deletions ansible/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
notes.txt
ansible.cfg
.yamlfmt
.run.sh

roles/deploy/files/resources
roles/deploy/files/lard_ingestion
40 changes: 8 additions & 32 deletions ansible/bigip.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,28 @@
- name: Copy schema for bigip
---
- name: Create what is needed for the bigip load balancers
hosts: servers
remote_user: ubuntu
vars:
ostack_cloud: lard
ostack_region: Ostack2-EXT
hosts: localhost # need to seperate this since done from localhost
gather_facts: false
pre_tasks:
# copy file, so we have an .sql file to apply locally
- name: Create a directory if it does not exist
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /etc/postgresql/16/db/bigip
state: directory
mode: '0755'
become: true
delegate_to: '{{ hostvars[groups["servers"][0]].ansible_host }}'
remote_user: ubuntu

- name: Copy the schema to the remote 1
ansible.builtin.copy:
src: ./roles/bigip/vars/bigip.sql
dest: /etc/postgresql/16/db/bigip/bigip.sql
mode: '0755'
become: true
delegate_to: '{{ hostvars[groups["servers"][0]].ansible_host }}'
remote_user: ubuntu
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /etc/postgresql/16/db/bigip
state: directory
mode: '0755'
become: true
delegate_to: '{{ hostvars[groups["servers"][1]].ansible_host }}'
remote_user: ubuntu
- name: Copy the schema to the remote 2
ansible.builtin.copy:
src: ./roles/bigip/vars/bigip.sql
dest: /etc/postgresql/16/db/bigip/bigip.sql
mode: '0755'
become: true
delegate_to: '{{ hostvars[groups["servers"][1]].ansible_host }}'
remote_user: ubuntu

- name: Create what is needed for the bigip load balancers
hosts: servers
remote_user: ubuntu
vars:
ostack_cloud: lard
ostack_region: Ostack2-EXT
gather_facts: false
# loops over both servers
roles:
- role: bigip
# will fail to create table in the standby (since read only)
- role: bigip
# will fail to create table in the standby (since read only)
26 changes: 15 additions & 11 deletions ansible/configure.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
---
- name: Mount disks and install stuff on the VMs
hosts: servers
remote_user: ubuntu
vars:
ostack_cloud: lard
ipalias_network_name: ipalias
ostack_region: Ostack2-EXT
# loops over both servers
pre_tasks:
- name: List ansible_hosts_all difference from ansible_host (aka the vm not currently being iterated on)
ansible.builtin.debug:
msg: "{{ (ansible_play_hosts_all | difference([inventory_hostname])) | first }}"
msg: "{{ (ansible_play_hosts_all | difference([inventory_hostname])) | first }}"
roles:
- role: addsshkeys
- role: addsshkeys
- role: vm_format
vars:
name_stuff: '{{ inventory_hostname }}' # name of current vm for finding ipalias port
name_stuff: "{{ inventory_hostname }}" # name of current vm for finding ipalias port
- role: ssh
vars:
vm_ip: '{{ ansible_host }}' # the current vm's ip
vm_ip: "{{ ansible_host }}" # the current vm's ip

- name: Setup primary and standby
vars:
Expand All @@ -26,10 +26,14 @@
hosts: localhost
gather_facts: false

roles:
roles:
- role: primarystandbysetup
vars:
primary_name: lard-a
primary_ip: '{{ hostvars[groups["servers"][0]].ansible_host }}' # the first one is a
standby_name: lard-b
standby_ip: '{{ hostvars[groups["servers"][1]].ansible_host }}' # the second one is b
when: inventory_hostname == "lard-a"

- role: standbysetup
when: inventory_hostname == "lard-b"
# vars:
# primary_name: lard-a
# primary_ip: '{{ ansible_host }}' # the first one is a
# standby_name: lard-b
# standby_ip: '{{ hostvars[groups["servers"][1]].ansible_host }}' # the second one is b
3 changes: 3 additions & 0 deletions ansible/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
# Deploy on both VMs, only the primary is "active"
hosts: servers
remote_user: ubuntu
gather_facts: false
# All role tasks require root user
become: true
roles:
- role: deploy
2 changes: 2 additions & 0 deletions ansible/host_vars/lard-a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
ansible_host: 123.123.123.123
2 changes: 2 additions & 0 deletions ansible/host_vars/lard-b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
ansible_host: 123.123.123.123
3 changes: 1 addition & 2 deletions ansible/inventory.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
servers:
hosts:
lard-a:
ansible_host: 157.249.*.*
lard-b:
ansible_host: 157.249.*.*
32 changes: 14 additions & 18 deletions ansible/provision.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
- name: setup networks and 2 vms
vars:
ostack_cloud: lard
ipalias_network_name: ipalias
ostack_region: Ostack2-EXT
hosts: localhost
---
- name: Setup networks and 2 vms
hosts: servers
gather_facts: false

roles:
- role: networks
- role: vm # in A
vars:
name_stuff: lard-a
availability_zone: ext-a
vm_ip: '{{ hostvars[groups["servers"][0]].ansible_host }}'
- role: vm # in B
vars:
name_stuff: lard-b
availability_zone: ext-b
vm_ip: '{{ hostvars[groups["servers"][1]].ansible_host }}'
tasks:
- name: Setup networks # noqa: run-once[task]
ansible.builtin.include_role:
name: networks
delegate_to: localhost
run_once: true

- name: Setup VMs
ansible.builtin.include_role:
name: vm
delegate_to: localhost
Loading
Loading