|
1 | 1 | --- |
| 2 | +- name: Install locale-gen |
| 3 | + apt: |
| 4 | + update_cache: true |
| 5 | + name: |
| 6 | + - locales |
| 7 | + |
2 | 8 | - name: Setup locales |
3 | 9 | community.general.locale_gen: |
4 | 10 | name: "{{ item }}" |
|
8 | 14 | - fr_FR.UTF-8 |
9 | 15 |
|
10 | 16 | - name: Set timezone to Europe/Paris |
11 | | - timezone: |
| 17 | + community.general.timezone: |
12 | 18 | name: Europe/Paris |
13 | 19 |
|
14 | 20 | - name: Add sources.list |
15 | | - template: |
| 21 | + ansible.builtin.template: |
16 | 22 | src: "etc/apt/sources.list.j2" |
17 | 23 | dest: "/etc/apt/sources.list" |
18 | 24 | mode: 0644 |
|
70 | 76 | - unattended-upgrades |
71 | 77 | - fail2ban |
72 | 78 | - haveged |
| 79 | + - gpg |
| 80 | + - dirmngr |
| 81 | + - gpg-agent |
73 | 82 |
|
74 | 83 | - name: Set fish as the root shell |
75 | | - user: |
| 84 | + ansible.builtin.user: |
76 | 85 | name: root |
77 | 86 | shell: /usr/bin/fish |
78 | 87 |
|
79 | 88 | - name: Add dotfiles |
80 | | - copy: |
| 89 | + ansible.builtin.copy: |
81 | 90 | src: "root/{{ item }}" |
82 | 91 | dest: "/root/" |
83 | 92 | mode: 0775 |
84 | 93 | with_items: |
85 | 94 | - .config |
86 | 95 |
|
87 | 96 | - name: Add config.fish |
88 | | - template: |
| 97 | + ansible.builtin.template: |
89 | 98 | src: root/.config/fish/config.fish.j2 |
90 | 99 | dest: /root/.config/fish/config.fish |
91 | 100 | mode: 0644 |
92 | 101 |
|
93 | 102 | - name: Add rsyslog logrotate without delaycompress |
94 | | - template: |
| 103 | + ansible.builtin.template: |
95 | 104 | src: "etc/logrotate.d/rsyslog.j2" |
96 | 105 | dest: "/etc/logrotate.d/rsyslog" |
97 | 106 | mode: 0644 |
|
108 | 117 | user_install: no |
109 | 118 |
|
110 | 119 | - name: Copy MOTD scripts |
111 | | - copy: |
| 120 | + ansible.builtin.copy: |
112 | 121 | src: "etc/update-motd.d/{{ item }}" |
113 | 122 | dest: "/etc/update-motd.d" |
114 | 123 | mode: +x |
|
118 | 127 | # - 30-apt |
119 | 128 |
|
120 | 129 | - name: Make sure /etc/motd is empty |
121 | | - copy: |
| 130 | + ansible.builtin.copy: |
122 | 131 | content: "" |
123 | 132 | dest: "/etc/motd" |
124 | 133 | mode: 0644 |
125 | 134 |
|
126 | 135 | - name: Install unbound |
127 | | - when: ansible_distribution == "Debian" |
| 136 | + when: ansible_distribution == "Debian" and inventory_hostname not in groups['pve'] |
128 | 137 | apt: |
129 | 138 | name: unbound |
130 | 139 |
|
131 | 140 | - name: Add Unbound config |
132 | | - when: ansible_distribution == "Debian" |
133 | | - template: |
| 141 | + when: ansible_distribution == "Debian" and inventory_hostname not in groups['pve'] |
| 142 | + ansible.builtin.template: |
134 | 143 | src: "etc/unbound/unbound.conf.j2" |
135 | 144 | dest: "/etc/unbound/unbound.conf" |
136 | 145 | mode: 0644 |
137 | 146 | notify: unbound restart |
138 | 147 |
|
139 | 148 | - name: Set DNS resolver to Unbound in DHCP config |
140 | | - when: ansible_distribution == "Debian" |
| 149 | + when: ansible_distribution == "Debian" and inventory_hostname not in groups['pve'] |
141 | 150 | lineinfile: |
142 | 151 | dest: /etc/dhcp/dhclient.conf |
143 | 152 | regexp: "^prepend domain-name-servers" |
144 | 153 | line: "prepend domain-name-servers 127.0.0.1;" |
145 | 154 |
|
146 | 155 | - name: Add vimrc |
147 | | - get_url: |
| 156 | + ansible.builtin.get_url: |
148 | 157 | url: https://raw.githubusercontent.com/wklken/vim-for-server/master/vimrc |
149 | 158 | dest: /root/.vimrc |
150 | 159 |
|
151 | 160 | - name: Add password to root user |
152 | | - user: |
| 161 | + ansible.builtin.user: |
153 | 162 | name: root |
154 | 163 | password: "{{ vault.root_password }}" |
155 | 164 |
|
156 | 165 | - name: Add stanislas user |
157 | | - user: |
| 166 | + ansible.builtin.user: |
158 | 167 | name: stanislas |
159 | 168 | groups: ["sudo"] |
160 | 169 | shell: /usr/bin/fish |
161 | 170 | password: "{{ vault.stanislas_password }}" |
162 | 171 |
|
163 | 172 | - name: Creates /home/stanislas/.ssh/ directory |
164 | | - file: |
| 173 | + ansible.builtin.file: |
165 | 174 | path: /home/stanislas/.ssh/ |
166 | 175 | state: directory |
167 | 176 | owner: stanislas |
168 | 177 | group: stanislas |
169 | 178 | mode: 0700 |
170 | 179 |
|
171 | 180 | - name: Set up SSH authorized keys |
172 | | - template: |
| 181 | + ansible.builtin.template: |
173 | 182 | src: "ssh/authorized_keys.j2" |
174 | 183 | dest: "{{ item }}" |
175 | 184 | mode: 0600 |
176 | 185 | with_items: |
177 | 186 | - /root/.ssh/authorized_keys |
178 | 187 | - /home/stanislas/.ssh/authorized_keys |
179 | 188 |
|
180 | | -- name: Set swappiness to 0 |
181 | | - ansible.posix.sysctl: |
182 | | - name: vm.swappiness |
183 | | - value: "0" |
184 | | - state: present |
185 | | - reload: yes |
186 | | - |
187 | 189 | - name: Copy unattended-upgrades configuration |
188 | | - copy: |
| 190 | + ansible.builtin.copy: |
189 | 191 | src: "etc/apt/apt.conf.d/{{ item }}" |
190 | 192 | dest: "/etc/apt/apt.conf.d/{{ item }}" |
191 | 193 | mode: 0644 |
|
194 | 196 | - "20auto-upgrades" |
195 | 197 |
|
196 | 198 | - name: Configure private network interface |
197 | | - template: |
| 199 | + ansible.builtin.template: |
198 | 200 | src: "etc/network/interfaces.d/priv.cfg.j2" |
199 | 201 | dest: "/etc/network/interfaces.d/priv.cfg" |
200 | 202 | mode: 0644 |
|
203 | 205 | tags: base.network |
204 | 206 |
|
205 | 207 | - name: Configure private network interface |
206 | | - template: |
| 208 | + ansible.builtin.template: |
207 | 209 | src: "etc/udev/rules.d/75-persistent-net-generator.rules.j2" |
208 | 210 | dest: "/etc/udev/rules.d/75-persistent-net-generator.rules" |
209 | 211 | mode: 0644 |
|
0 commit comments