-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebian-setup.yml
105 lines (92 loc) · 2.32 KB
/
debian-setup.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
---
- hosts: debiantest
become: true
become_method: su
become_user: root
tasks:
- name: Update and upgrade apt packages
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day
- name: Install packages
apt:
name:
- ncdu
- git
- vim
- htop
- sudo
- wget
- nfs-common
- autofs
state: present
- name: Install mail packages
apt:
name:
- msmtp-mta
- bsd-mailx
state: present
- name: Configure mail server
template:
src: "msmtprc.j2"
dest: "/etc/msmtprc"
mode: 0644
# owner: root
- name: Add user to sudoers
user:
name: '{{ debian_user }}'
groups: sudo
append: yes
- name: Setting VIM
copy:
dest: "{{ item }}"
content: |
source $VIMRUNTIME/defaults.vim
set mouse-=a
with_items:
- /home/{{ debian_user }}/.vimrc
- /root/.vimrc
- name: Add aliases
blockinfile:
state: present
insertafter: EOF
dest: "{{ item }}"
content: |
alias ll='ls -lah --color'
with_items:
- /home/{{ debian_user }}/.bashrc
- /root/.bashrc
- name: Chown all user folders
file:
path: "/home/{{ debian_user }}"
state: directory
recurse: yes
owner: "{{ debian_user }}"
group: "{{ debian_user }}"
- name: Add mail variables in crontab
cronvar:
name: "{{item.0}}"
value: "{{ debian_smtp_user }}"
user: "{{item.1}}"
with_nested:
- ['MAILTO', 'MAILFROM']
- ["{{ debian_user }}", 'root']
- name: Add path variable in crontab
cronvar:
name: "PATH"
value: "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
user: "{{ item }}"
with_items:
- {{ debian_user }}
- root
- name: change user passwords
user:
name: "{{ debian_user }}"
state: present
password: "{{ debian_user_password | password_hash('sha512') }}"
- name: change root passwords
user:
name: "root"
state: present
password: "{{ debian_root_password | password_hash('sha512') }}"