This repository has been archived on 2024-05-02. You can view files and clone it, but cannot push or open issues or pull requests.
omni-ansible/playbooks/provision.yml

75 lines
2.5 KiB
YAML
Raw Normal View History

---
- 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:
msg: "Standard configuration deployment is only supported on Fedora 28/29, Centos 7.5, and RHEL"
- 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:
- import_tasks: tasks/centos/repositories.yml
when: ansible_distribution == "CentOS"
- import_tasks: tasks/centos/packages.yml
when: ansible_distribution == "CentOS"
- import_tasks: tasks/fedora/packages.yml
when: ansible_distribution == "Fedora"
# - import_tasks: tasks/debian/packages.yml
# 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:
- import_tasks: tasks/centos/networkd.yml
when: ansible_distribution == "CentOS"
- import_tasks: tasks/fedora/networkd.yml
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 }}"