Skip to content

Commit

Permalink
ansible installation [wip]
Browse files Browse the repository at this point in the history
  • Loading branch information
Limmen committed Mar 10, 2024
1 parent 8e6f351 commit 901b240
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 27 deletions.
6 changes: 3 additions & 3 deletions ansible/group_vars/all/variables.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
user: "kim"
csle_git_repo_url: "https://github.com/Limmen/csle"
leader_ip: "172.31.212.85"
leader_ip: "172.31.212.82"
nginx_content_name: "nginx_configuration_content.txt"
web_port: 7777
postgres_version: "15"
Expand Down Expand Up @@ -57,13 +57,13 @@ csle_config:
postgresql_log_dir: "/var/log/postgresql/"
nginx_log_dir: "/var/log/nginx/"
default_log_dir: "/tmp/csle/"
metastore_ip: "172.31.212.85"
metastore_ip: "172.31.212.82"
metastore_user: "csle"
metastore_password: "csle"
metastore_database_name: "csle"
cluster_config:
cluster_nodes:
- ip: "172.31.212.85"
- ip: "172.31.212.82"
leader: true
cpus: 24
gpus: 0
Expand Down
4 changes: 2 additions & 2 deletions ansible/install_emulation_system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
base_images_pulled: "{{ spark_base in docker_images_list.stdout }}"

- name: Check if the derived images are pulled
set_fact:
derived_images_pulled: "{{ spark_derived in docker_images_list.stdout }}"
set_fact:
derived_images_pulled: "{{ spark_derived in docker_images_list.stdout }}"

- name: Pulling base Docker images
shell: "cd /home/{{ user }}/csle/emulation-system/base_images && make pull"
Expand Down
12 changes: 6 additions & 6 deletions ansible/install_management_system_leader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
tasks:

- name: List running docker containers
become: true
shell: "docker ps"
args:
executable: /bin/bash
register: docker_containers_list
changed_when: false
become: true
shell: "docker ps"
args:
executable: /bin/bash
register: docker_containers_list
changed_when: false

- name: Check if pg_admin is running
set_fact:
Expand Down
29 changes: 14 additions & 15 deletions ansible/install_metastore_leader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
- name: Clear create_cluster.sql file
shell: "rm /home/{{ user }}/csle/metastore/create_cluster.sql; touch /home/{{ user }}/csle/metastore/create_cluster.sql"

- name: Add leader to create_cluster.sql file
shell: echo SELECT "citus_set_coordinator_host('{{ leader_ip }}', {{ citus_port }});" >> "/home/{{ user }}/csle/metastore/create_cluster.sql"

- name: Add workers to create_cluster.sql file
shell: echo SELECT "citus_add_node('{{ item }}', {{ citus_port }});" >> "/home/{{ user }}/csle/metastore/create_cluster.sql"
loop: "{{ groups['worker'] }}"
- name: Add leader to create_cluster.sql file
shell: echo SELECT "citus_set_coordinator_host('{{ leader_ip }}', {{ citus_port }});" >> "/home/{{ user }}/csle/metastore/create_cluster.sql"

- name: Add workers to create_cluster.sql file
shell: echo SELECT "citus_add_node('{{ item }}', {{ citus_port }});" >> "/home/{{ user }}/csle/metastore/create_cluster.sql"
loop: "{{ groups['worker'] }}"

- name: Copy create_tables.sql script to postgres home
become: true
Expand Down Expand Up @@ -50,15 +49,15 @@
line: ''

- name: Create PostgreSQL tables, if you see error here just ignore it!
become: yes
become_method: sudo
become_user: postgres
community.postgresql.postgresql_script:
login_user: postgres
login_password: "{{ postgres_password }}"
db: csle
path: /var/lib/postgresql/create_tables.sql
ignore_errors: true
become: yes
become_method: sudo
become_user: postgres
community.postgresql.postgresql_script:
login_user: postgres
login_password: "{{ postgres_password }}"
db: csle
path: /var/lib/postgresql/create_tables.sql
ignore_errors: true

- name: Create PostgreSQL CITUS cluster
become: yes
Expand Down
2 changes: 1 addition & 1 deletion ansible/inventory
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[leader]
172.31.212.85
172.31.212.82

[worker]

0 comments on commit 901b240

Please sign in to comment.