Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (83 sloc) 2.17 KB
---
- hosts: all
become: true
tasks:
- name: "Build hosts file"
lineinfile:
dest: /etc/hosts
regexp: '.*{{ item }}$'
line: "{{ hostvars[item]['ansible_eth0']['ipv4']['address'] }} {{item}}"
state: present
with_items: "{{ groups['all'] }}"
- name: Check if machine id has been already reconfigured
stat:
path: /etc/machine_id_configured
register: machine_id_configured
- name: Reconfigure machine id if not done yet
shell: |
dbus-uuidgen > /var/lib/dbus/machine-id
rm /etc/machine-id
systemd-machine-id-setup
when: not machine_id_configured.stat.exists
- name: Create check file if not exists
file:
path: /etc/machine_id_configured
state: touch
owner: root
group: sys
mode: 0555
when: not machine_id_configured.stat.exists
- name: disable & stop wpa_supplicant
systemd:
name: wpa_supplicant
enabled: no
state: stopped
- name: Disable wifi driver via blacklist
kernel_blacklist:
name: r8723bs
state: present
- name: Unload wifi driver
modprobe:
name: r8723bs
state: absent
- name: ensure systemd-networkd is enabled and running
systemd:
name: systemd-networkd
enabled: yes
state: started
- name: Upgrade packages
apt:
update_cache: yes
upgrade: safe
- name: Install nfs-commons
apt:
name: "{{ item }}"
state: installed
with_items:
- nfs-common
- name: disable zram
systemd:
name: zram-config
enabled: no
state: stopped
- name: disable swap
shell: swapoff -a
- name: pass bridged traffic to iptables
sysctl:
name: net.bridge.bridge-nf-call-iptables
value: 1
state: present
- name: Check if docker is installed
command: dpkg-query -l docker-ce
register: is_docker_installed
failed_when: is_docker_installed.rc > 1
changed_when: no
- name: Download docker install script
get_url:
url: https://get.docker.com
dest: /tmp/docker.sh
mode: 0777
when: is_docker_installed.rc == 1
- name: Install docker
shell: /tmp/docker.sh
when: is_docker_installed.rc == 1