Skip to content

Commit e78709e

Browse files
committed
fixed connect to host 10.0.2.5 port 22: issue
1 parent 2f0a303 commit e78709e

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

ansible/api-setup.yml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,40 @@
44
become: yes
55
vars:
66
app_path: /home/adminuser/ansible-setup/src/movie-analyst-api
7-
node_version: "16"
7+
ansible_ssh_common_args: "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
8+
ansible_ssh_private_key_file: "~/.ssh/vm_ssh_key"
9+
10+
pre_tasks:
11+
- name: Wait for SSH to become available
12+
wait_for_connection:
13+
timeout: 60
14+
15+
- name: Verify network connectivity
16+
ping:
817

918
tasks:
10-
- name: Install Node.js via Nodesource
11-
apt:
12-
pkg:
13-
- ca-certificates
14-
- gnupg
15-
update_cache: yes
16-
tags: nodejs
19+
- name: Install Node.js via Nodesource (replaces NVM)
20+
block:
21+
- name: Install prerequisites
22+
apt:
23+
name:
24+
- ca-certificates
25+
- curl
26+
- gnupg
27+
state: present
28+
update_cache: yes
1729

18-
- name: Add Nodesource repository
19-
apt_repository:
20-
repo: "deb https://deb.nodesource.com/node_{{ node_version }}.x {{ ansible_distribution_release }} main"
21-
state: present
22-
update_cache: yes
23-
tags: nodejs
30+
- name: Add Nodesource repository
31+
apt_repository:
32+
repo: "deb https://deb.nodesource.com/node_16.x {{ ansible_distribution_release }} main"
33+
state: present
34+
update_cache: yes
2435

25-
- name: Install Node.js
26-
apt:
27-
name: nodejs
28-
state: present
29-
update_cache: yes
30-
tags: nodejs
36+
- name: Install Node.js
37+
apt:
38+
name: nodejs
39+
state: present
40+
update_cache: yes
3141

3242
- name: Ensure app directory exists
3343
file:
@@ -53,7 +63,7 @@
5363

5464
- name: Configure systemd service
5565
template:
56-
src: "{{ playbook_dir }}/templates/movie-api.service.j2"
66+
src: "{{ playbook_dir }}/../templates/movie-api.service.j2"
5767
dest: /etc/systemd/system/movie-api.service
5868
owner: root
5969
group: root

0 commit comments

Comments
 (0)