Skip to content

Commit

Permalink
Implement Ansible for Project Deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
ritvik-32 committed Sep 11, 2024
1 parent b146d9e commit 41707d7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ansible/example_inventory.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ansible_ssh_private_key_file=" Add the path to the ssh private key example:~/.ss
user_home="{{ ansible_env.HOME }}"
path="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/go/bin:/{{ user_home }}/go/bin"
go_version=1.18.10
ssh_file_path="Specify the path to id_rsa.pub Example: ".ssh/id_rsa.pub
ssh_file_path="Specify the path to id_rsa.pub Example: .ssh/id_rsa.pub "
digital_ocean_api_token="Specify digital ocean api token"
ssh_key_name="Specify the name of your ssh key in the digital ocean account"
user="Specify the type of user you want ex: root"
Expand Down
7 changes: 1 addition & 6 deletions ansible/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
hosts: localhost
vars:
droplets_to_create: 1

tasks:
- name: Get DigitalOcean SSH Key ID
uri:
Expand Down Expand Up @@ -216,7 +216,6 @@

- name: sleep for a few seconds
command: sleep 30


- name: Install Docker
shell: sudo apt update && sudo apt install -y apt-transport-https ca-certificates curl software-properties-common && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io && sudo systemctl enable docker && sudo systemctl start docker
Expand Down Expand Up @@ -255,8 +254,6 @@

become_user: "{{ ansible_user }}"



- name: Copy the Dockerfile
become_user: "{{ ansible_user }}"
copy:
Expand Down Expand Up @@ -340,5 +337,3 @@
- name: Restart the journald service file
shell: systemctl restart systemd-journald.service
become: true


3 changes: 2 additions & 1 deletion ansible/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ ssh_key_name="Specify the name assigned to your ssh key on digital ocean"
```

3. Run the playbook using the command :
```ansible-playbook main.yml -i inventory.ini```
```ansible-playbook main.yml -i inventory.ini```
4. Enter the server ip:3000 to open the resolute frontend

0 comments on commit 41707d7

Please sign in to comment.