-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite_before_roles.yml
110 lines (87 loc) · 2.05 KB
/
site_before_roles.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
- hosts: all
become: true
pre_tasks:
- name: install update (Ubuntu)
tags: always
apt:
update_cache: yes
changed_when: false
- hosts: all
become: true
tasks:
- name: create simone user
tags: always
user:
name: simone
groups: root
- name: add ssh key for simone
tags: always
authorized_key:
user: simone
key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFrLMeEYn7VkMSaLfsl4GzYZmGCDecfMc1DxdHOFBXXZ ansible"
- hosts: workstations
become: true
tasks:
- name: install unzip
package:
name: unzip
- name: install terraform
unarchive:
src: https://releases.hashicorp.com/terraform/1.9.4/terraform_1.9.4_linux_arm64.zip
dest: /usr/local/bin
remote_src: yes
mode: 0755
owner: root
group: root
- hosts: web_servers
become: true
tasks:
- name: install apache2 and php package
tags: apache2,php
package:
name:
- "{{ apache_package }}"
- "{{ php_package }}"
state: latest
- name: start httpd
tags: apache,unbutu
service:
name: apache2
state: started
- name: change e-mail address for admin
tags: apache,apache2
lineinfile:
path: /etc/apache2/sites-available/000-default.conf
regexp: '^ServerAdmin'
line: ServerAdmin somebody@somewhere.net
register: apache2
- name: restart apache2
tags: apache,apache2
service:
name: apache2
state: restarted
when: apache2.changed
- name: copy html file for site
tags: apache,apache2,httpd
copy:
src: default_site.html
dest: /var/www/html/index.html
owner: root
group: root
mode: 0644
- hosts: db_servers
become: true
tasks:
- name: install mariadb package
tags: db, mariadb
apt:
name: mariadb-server
- hosts: file_servers
become: true
tasks:
- name: install samba package
tags: file_servers, samba
package:
name: samba
state: latest