-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.yml
47 lines (40 loc) · 1.13 KB
/
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
- name: Updates
hosts: all
become: true
tasks:
- name: Task name
stat:
path: /etc/netplan/01-ansible-config.yaml
register: netplan_configured
- name: Copy the template ansible-config.yaml over
template:
src: ansible-config.yaml.ubuntu.j2
dest: /etc/netplan/01-ansible-config.yaml
owner: root
group: root
mode: 0644
when: not netplan_configured.stat.exists
- name: Remove existing netplan
command: rm /etc/netplan/00-ansible-config.yaml
ignore_errors: true
when: not netplan_configured.stat.exists
- name: Apply netplan
command: sudo netplan apply
async: 45
poll: 0
when: not netplan_configured.stat.exists
- name: Set hostname
command: sudo hostnamectl set-hostname {{ inventory_hostname }}
tags: hostname
when: not netplan_configured.stat.exists
- name: distribute the /etc/motd file
template:
src: motd.j2
dest: /etc/motd
owner: root
group: root
mode: 0644
tags:
- motd_config
changed_when: true
when: not netplan_configured.stat.exists