forked from mmumshad/udemy-ansible-assignment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-networking.yml
45 lines (41 loc) · 1.34 KB
/
setup-networking.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
- name: Set up networking
hosts: localhost
gather_facts: False
tasks:
- name: Allow HTTP traffic
gce_net:
fwname: all-http
name: default
allowed: tcp:80
project_id: "{{ project_id }}"
credentials_file: "{{ credentials_file }}"
service_account_email: "{{ service_account_email }}"
- name: Allow HTTP traffic
gce_net:
fwname: all-database
name: default
allowed: tcp:3306
project_id: "{{ project_id }}"
credentials_file: "{{ credentials_file }}"
service_account_email: "{{ service_account_email }}"
- name: Create the load-balancer and add members
gce_lb:
name: lb1
region: "{{ region }}"
members: "{{ lb_members }}"
project_id: "{{ project_id }}"
credentials_file: "{{ credentials_file }}"
service_account_email: "{{ service_account_email }}"
register: lb_result
- name: Load balancer result
debug:
msg: "{{ lb_result }}"
- name: Send notification email
mail:
host: smtp.gmail.com
port: 465
username: mmumshad@gmail.com
password: "{{ g_password }}"
to: Mumshad Mannambeth <mmumshad@gmail.com>
subject: Ansible-report
body: 'Go to http://{{ lb_result.external_ip }} to access your web application.'