-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdeploy-app-prod.yml
40 lines (36 loc) · 1.25 KB
/
deploy-app-prod.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
---
# This playbook adds a user, and expects to be passed a username variable on the ansible-playbook command line
- hosts: prod_web_servers
become_user: root
become_method: sudo
become: yes
tasks:
- name: Install web server
yum: state=present name={{ item }}
tags: software
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7
with_items:
- httpd
- name: Deploy web application
git:
repo: 'https://github.com/aludwar/webapp.git'
dest: /var/www/html
#version: release-0.22
- name: Start/enable web server
systemd:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- 'httpd'
tags: software
when: ansible_distribution == 'RedHat' and ansible_distribution_major_version|int == 7
- name: Set firewall rules to allow http/https
firewalld:
service: "{{ item }}"
permanent: true
state: enabled
immediate: yes
with_items:
- https
- http