-
Notifications
You must be signed in to change notification settings - Fork 0
/
httpd-inst.yml
41 lines (38 loc) · 1.05 KB
/
httpd-inst.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
---
- name: Get VM Tag & httpd install & Firewall (80/443) config
hosts: all
gather_facts: yes
tasks:
- name: Confirm VM Tag & Register to variable
vmware_guest_info:
hostname: "{{lookup('env', 'VMWARE_HOST')}}"
username: "{{lookup('env', 'VMWARE_USER')}}"
password: "{{lookup('env', 'VMWARE_PASSWORD')}}"
validate_certs: False
datacenter: DC
name: "{{ansible_nodename}}"
tags: yes
register: vm_facts
delegate_to: localhost
- name: httpd install
yum:
name: httpd
state: latest
when: vm_facts.instance.tags == ["New_VM"]
- name: httpd running & Enabled
service:
name: httpd
state: started
enabled: yes
when: vm_facts.instance.tags == ["New_VM"]
- name: Firewall Setting 80/443
firewalld:
service: "{{item}}"
zone: public
state: enabled
permanent: true
immediate: true
with_items:
- http
- https
when: vm_facts.instance.tags == ["New_VM"]