-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcore.yml
88 lines (74 loc) · 2.51 KB
/
core.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
---
- name: Cosmo | Bootstrap connexion
hosts: planet_computers
gather_facts: false
tasks:
- name: Bootstrap connexion
import_tasks: tasks/bootstrap.yml
when: bootstrapped is undefined
- name: Mark cosmo as bootstrapped
set_fact:
bootstrapped: true
- name: Cosmo | Core
hosts: planet_computers
become: true
diff: true
tasks:
- name: Cosmo | Core - Workaround to allow apt change and update cache
command: apt update --allow-releaseinfo-change
changed_when: false
- name: Cosmo | Core - Upgrade installed packages
apt:
upgrade: 'yes'
- name: Cosmo | Core - Install basic packages
apt:
name: "{{ system_packages }}"
state: present
when: system_packages is defined
- name: Cosmo | Core - Change hostname
hostname:
name: "{{ new_hostname }}"
use: systemd
when: new_hostname is defined
- name: Cosmo | Core - Set timezone
timezone:
name: "{{ cosmo.timezone }}"
when: cosmo is defined and cosmo.timezone is defined
- name: Cosmo | Core - Ensure locale exists
locale_gen:
name: "{{ cosmo.locale }}.UTF-8"
state: present
when: cosmo is defined and cosmo.locale is defined
- name: Cosmo | Core - NetworkManager - Add wifi configuration
template:
src: wifi.j2
dest: "/etc/NetworkManager/system-connections/{{ item.ssid }}"
owner: root
group: root
mode: '0600'
loop: "{{ wifi }}"
register: network_conf
- name: Cosmo | Core - NetworkManager - Restart the service
systemd:
name: NetworkManager
state: restarted
enabled: yes
when: network_conf.changed
- name: Cosmo | Core - Keyboard layout
block:
- name: Cosmo | Core - KeyboardCheck if .profile file exist
stat:
path: "/home/{{ ansible_ssh_user }}/.profile"
register: profile
- name: Cosmo | Core - Keyboard Create .profile
file:
path: "/home/{{ ansible_ssh_user }}/.profile"
state: touch
when: not profile.stat.exists
- name: Cosmo | Core - Keyboard Add .profile template to correct keyboard layout
lineinfile:
path: "/home/{{ ansible_ssh_user }}/.profile"
state: present
regexp: "^/usr/bin/setxkbmapsetxkbmap"
line: "/usr/bin/setxkbmap -model planetcosmo -layout {{ cosmo.keyboard }}"
when: cosmo is defined and cosmo.keyboard is defined