2018-11-27 06:30:55 +00:00
|
|
|
---
|
|
|
|
- hosts: all
|
|
|
|
name: Init
|
|
|
|
tasks:
|
|
|
|
- name: Check system compatibility
|
|
|
|
when: ansible_distribution != "CentOS" and ansible_distribution != "Red Hat Enterprise Linux" and ansible_distribution != "Fedora"
|
|
|
|
meta: end_play
|
|
|
|
debug:
|
2018-12-11 05:48:37 +00:00
|
|
|
msg: "Standard configuration deployment is only supported on Fedora 28/29, Centos 7.5, and RHEL"
|
2018-11-27 06:30:55 +00:00
|
|
|
|
|
|
|
- name: Set hostname
|
|
|
|
become: true
|
|
|
|
hostname:
|
|
|
|
name: "{{ default_host if default_host is defined else inventory_hostname }}"
|
|
|
|
|
|
|
|
- name: Install MOTD
|
|
|
|
become: true
|
|
|
|
template:
|
|
|
|
src: motd.j2
|
|
|
|
dest: /etc/motd
|
|
|
|
mode: 0644
|
|
|
|
|
|
|
|
- name: Install global bashrc
|
|
|
|
become: true
|
|
|
|
template:
|
|
|
|
src: bashrc.j2
|
|
|
|
dest: /etc/profile.d/30-omni-bashrc.sh
|
|
|
|
mode: 0644
|
|
|
|
|
|
|
|
- hosts: all
|
|
|
|
name: System packages
|
|
|
|
tasks:
|
2018-12-11 05:48:37 +00:00
|
|
|
- import_tasks: tasks/centos/repositories.yml
|
2018-11-27 06:30:55 +00:00
|
|
|
when: ansible_distribution == "CentOS"
|
2018-12-11 05:48:37 +00:00
|
|
|
- import_tasks: tasks/centos/packages.yml
|
2018-11-27 06:30:55 +00:00
|
|
|
when: ansible_distribution == "CentOS"
|
2018-12-11 05:48:37 +00:00
|
|
|
- import_tasks: tasks/fedora/packages.yml
|
2018-11-27 06:30:55 +00:00
|
|
|
when: ansible_distribution == "Fedora"
|
2018-12-11 05:48:37 +00:00
|
|
|
# - import_tasks: tasks/debian/packages.yml
|
2018-11-27 06:30:55 +00:00
|
|
|
# when: ansible_distribution == "Debian" or ansible_distribution == "Ubuntu"
|
|
|
|
|
|
|
|
|
|
|
|
- import_playbook: update-system.yml
|
|
|
|
|
|
|
|
|
|
|
|
- hosts: all
|
|
|
|
name: Replace NetworkManager with systemd-networkd
|
|
|
|
tasks:
|
|
|
|
- name: Install systemd-networkd
|
|
|
|
when: enable_networkd == true
|
|
|
|
block:
|
2018-12-11 05:48:37 +00:00
|
|
|
- import_tasks: tasks/centos/networkd.yml
|
2018-11-27 06:30:55 +00:00
|
|
|
when: ansible_distribution == "CentOS"
|
2018-12-11 05:48:37 +00:00
|
|
|
- import_tasks: tasks/fedora/networkd.yml
|
2018-11-27 06:30:55 +00:00
|
|
|
when: ansible_distribution == "Fedora"
|
|
|
|
# - import_tasks: common/debian/networkd.yml
|
|
|
|
# when: ansible_distribution == "Debian" or ansible_distribution == "Ubuntu"
|
|
|
|
- name: Configure systemd-networkd
|
|
|
|
when: enable_networkd == true
|
|
|
|
- import_tasks: common/networkd.yml
|
|
|
|
|
|
|
|
|
|
|
|
- hosts: all
|
|
|
|
name: Register static DHCP entries
|
|
|
|
tasks:
|
|
|
|
- name: Install static DHCP leases
|
|
|
|
delegate_to: {{ router.address }}
|
|
|
|
when: networking is defined
|
|
|
|
edgeos_config:
|
|
|
|
save: true
|
|
|
|
lines:
|
|
|
|
- set service dhcp-server shared-network-name {{ router.static.server }} subnet {{ router.static.subnet }} static-mapping {{ item.alias | default(inventory_hostname) }} mac-address {{ item.mac }}
|
|
|
|
- set service dhcp-server shared-network-name {{ router.static.server }} subnet {{ router.static.subnet }} static-mapping {{ item.alias | default(inventory_hostname) }} ip-address {{ item.address }}
|
|
|
|
with_dict: "{{ networking }}"
|