-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.yml
87 lines (76 loc) · 1.84 KB
/
site.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
75
76
77
78
79
80
81
82
83
84
85
86
---
- hosts: all
become: true
pre_tasks:
- name: install updates (CentOS)
dnf:
update_only: yes
when: ansible_distribution == "CentOS"
- name: install updates (ubuntu)
apt:
upgrade: dist
when: ansible_distribution == "Ubuntu"
- name: using package to update cache and install samba
package:
name: samba
state: latest
update_cache: yes
- hosts: web_servers
become: true
tasks:
- name: install apache2 and php package, update cache for ubuntu
tags: apache,apache2,ubuntu
apt:
name:
- apache2
- libapache2-mod-php
state: latest
when: ansible_distribution == "Ubuntu"
- name: install apache2 and php package, update cache for centos
tags: apache,centos
dnf:
name:
- httpd
- php
state: latest
when: ansible_distribution == "CentOS"
- name: shell httpd php
shell: systemctl start httpd; firewall-cmd --add-port=80/tcp
when: ansible_distribution == "CentOS"
- name: copy def_site.html
tags: apache
copy:
src: def_site.html
dest: /var/www/html/index.html
owner: root
group: root
mode: 0644
- hosts: db_servers
become: true
tasks:
- name: install mariadb (ubuntu)
tags: ubuntu,mariadb,db
apt:
name: mariadb-server
state: latest
when: ansible_distribution == "Ubuntu"
- name: install mariadb (CentOS)
tags: centos,mariadb,db
dnf:
name: mariadb
state: latest
when: ansible_distribution == "CentOS"
- hosts: only_terraform
become: true
tasks:
- name: install unzip
package:
name: unzip
- name: install tf
unarchive:
src: https://releases.hashicorp.com/terraform/1.0.7/terraform_1.0.7_linux_amd64.zip
dest: /usr/local/bin
remote_src: yes
mode: 0755
owner: root
group: root