-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.yml
41 lines (32 loc) · 1.14 KB
/
main.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
# Set of tasks to apply to all hosts
- name: Set /etc/hostname to {{ inventory_hostname }}
template: src='hostname.j2' dest='/etc/hostname'
- name: Write /etc/hosts with {{ inventory_hostname }}
template: src='hosts.j2' dest='/etc/hosts'
# Directory for keeping misc ansible files
- name: Create managed files dir
file: name={{ managed_file_dir }} state=directory
- name: Set /etc/localtime
file: src=/usr/share/zoneinfo/{{ timezone }} dest=/etc/localtime state=link force=yes
- name: Set /etc/timezone
copy: content="{{ timezone }}" dest=/etc/timezone
- name: Install ntp, netfilter-persistent, rsyslog
apt: name={{item}} state=present
with_items:
- ntp
- netfilter-persistent
- rsyslog
- name: Put iptables configuration
template: src={{ inventory_dir }}/templates/common/{{item}}.j2 dest=/etc/iptables/{{ item }}
with_items:
- rules.v4
- rules.v6
notify:
- restart netfilter-persistent
- name: Enable services ntpd, netfilter-persistent on boot
service: name={{item}} enabled=true
with_items:
- ntp
- netfilter-persistent
# Include environment specific tasks
- include_tasks: "{{ inventory_dir }}/tasks/common.yml"