Skip to content

Commit

Permalink
Added basic ansible playbook
Browse files Browse the repository at this point in the history
  • Loading branch information
kaustubhkapatral committed Sep 13, 2022
1 parent 6059145 commit f36b6df
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Sample Ansible playbook

12 changes: 12 additions & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# config file for ansible -- https://ansible.com/
# ===============================================

[defaults]
inventory = ./inventory.yml
host_key_checking = False
remote_user = ubuntu
deprecation_warnings=False
private_key_file = .workspace/private.pem
ansible_ssh_private_key_file: /home/user/id_rsa
ansible_connection: ssh
ansible_ssh_user: ubuntu
2 changes: 2 additions & 0 deletions ansible/group_vars/all
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
ansible_user: ubuntu
11 changes: 11 additions & 0 deletions ansible/inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all:

hosts:
children:
sentry:
hosts:
123.456.789.12:
23.34.45.56:
validator:
hosts:
45.56.78.89:
21 changes: 21 additions & 0 deletions ansible/playbooks/network.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Node setup
hosts: all
tasks:
- name: Install deps
include_role:
name: roles/install-deps
apply:
tags: always
tags:
- install_deps

- name: Install binary
include_role:
name: roles/install-binary
apply:
tags: always
tags:
- Build


Empty file.
4 changes: 4 additions & 0 deletions ansible/roles/install-binary/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
branch: master

repo: https://github.com/cosmos/gaia.git
56 changes: 56 additions & 0 deletions ansible/roles/install-deps/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# Installing deps

- name: apt-get update
apt:
update_cache: yes
become: true

- name: build-essential
action: apt pkg=build-essential
become: true

- name: libssl-dev
action: apt pkg=libssl-dev
become: true

- name: libseccomp-dev
action: apt pkg=libseccomp-dev
become: true

- name: pkg-config
action: apt pkg=pkg-config
become: true

- name: jq
action: apt pkg=jq
become: true

- name: git
action: apt pkg=git
become: true

- name: make
action: apt pkg=make
become: true

- name: netstat
action: apt pkg=netstat-tools
become: true


- name: Download go script
get_url:
url: https://gist.githubusercontent.com/kaustubhkapatral/e0ee6100acb42bd9d4d97f067f7ce3eb/raw/30f9b7eca627986610ec9bafa217341df85502ed/go.sh
dest: "{{ ansible_env.HOME }}/go.sh"
mode: '0755'

- name: Run go.sh
command: bash go.sh
args:
chdir: "{{ ansible_env.HOME }}"

- name: Remove go.sh
file:
path: "{{ ansible_env.HOME }}/go.sh"
state: absent

0 comments on commit f36b6df

Please sign in to comment.