-
Notifications
You must be signed in to change notification settings - Fork 32
/
main.yaml
68 lines (58 loc) · 1.65 KB
/
main.yaml
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
- name: Add ssh key
ansible.posix.authorized_key:
key: https://github.com/{{ github_user_for_ssh_key }}.keys
user: "{{ ansible_user }}"
comment: "github-{{ github_user_for_ssh_key }}"
- name: Lock password for {{ ansible_user }}
user:
name: "{{ ansible_user }}"
password_lock: yes
- name: bashrc for {{ ansible_user }}
blockinfile:
path: "/home/{{ ansible_user }}/.bashrc"
block: alias ll='ls -la'
- name: bashrc for root
blockinfile:
path: "{{ ansible_user_dir }}/.bashrc"
block: |
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -la'
alias l='ls $LS_OPTIONS -lA'
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
- name: Set timezone
lineinfile:
path: /etc/timezone
regexp: "^"
line: "{{ timezone }}"
- name: Set localtime
file:
src: /usr/share/zoneinfo/{{ timezone }}
dest: /etc/localtime
state: link
- name: Set hostname
lineinfile:
path: /etc/hostname
regexp: "^"
line: "{{ inventory_hostname }}"
notify: Reboot after hostname change
- name: Set hosts
lineinfile:
path: /etc/hosts
regexp: "^127.0.1.1"
line: 127.0.1.1 {{ inventory_hostname }}
notify: Reboot after hostname change
- name: Set custom DNS servers
blockinfile:
path: /etc/dhcpcd.conf
block: static domain_name_servers={{ static_dns }}
notify: Restart dhcpcd
- name: Flush handlers
meta: flush_handlers