-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx_nodejs.yml
74 lines (65 loc) · 1.73 KB
/
nginx_nodejs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
### PlayBook to Create an EC2 Instance and Install Packages ###
- name: ec2_instance_launch
hosts: all
become: true
gather_facts: no
tasks:
- name: ec2_config
ec2:
key_name: ssh_key
instance_type: t2.micro
instance_profile_name: AdminS3access
image: ami-02e60be79e78fef21
instance_tags:
Name: ansible_deployed_node
volumes:
- device_name: /dev/sda1
delete_on_termination: yes
volume_type: gp2
volume_size: 8
wait: yes
group_id: sg-0bd6469705bbe6ed2
count: 1
vpc_subnet_id: subnet-b5f383dd
assign_public_ip: yes
region: ap-south-1
register: ec2
- name: Adding IP to group
add_host:
hostname: "{{ item.public_ip }}"
groupname: ec2_hosts
with_items: "{{ ec2.instances }}"
- name: SSH Connection to Active
delegate_to: "{{ item.public_dns_name }}"
wait_for_connection:
delay: 60
with_items: "{{ ec2.instances }}"
- name: Installation of Python and Nodejs
hosts: ec2_hosts
become: true
gather_facts: no
tasks:
- name: Add Epel Repository
yum:
name: epel-release
state: present
- name: Add Nodejs Repository
get_url:
url: https://rpm.nodesource.com/setup_10.x
dest: /tmp/install.sh
mode: 0555
- name: Exceuting Script
shell: bash /tmp/install.sh
- name: Installation of Packages Python & Nodejs
yum:
name:
- nginx
- nodejs
- python36
state: present
- name: Service Restart
service:
name: nginx
state: restarted
enabled: yes