94 lines
2.5 KiB
YAML
94 lines
2.5 KiB
YAML
---
|
|
- hosts: all
|
|
become: true
|
|
tasks:
|
|
- name: Preparation
|
|
ansible.builtin.shell: curl -1sLf 'https://dl.cloudsmith.io/public/isc/kea-2-6/setup.deb.sh' | sudo -E bash
|
|
|
|
- name: Update apt
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
|
|
- name: Installation isc-kea-dhcp4
|
|
ansible.builtin.apt:
|
|
name: isc-kea-dhcp4-server
|
|
state: present
|
|
|
|
- name: Installation isc-kea-ctrl-agent
|
|
ansible.builtin.apt:
|
|
name: isc-kea-ctrl-agent
|
|
state: present
|
|
|
|
- name: Installation isc-kea-hooks
|
|
ansible.builtin.apt:
|
|
name: isc-kea-hooks
|
|
state: present
|
|
|
|
- name: Generation du fichier de configuration kea-ctrl-agent
|
|
ansible.builtin.template:
|
|
src: kea-ctrl-agent.conf.j2
|
|
dest: /etc/kea/kea-ctrl-agent.conf
|
|
backup: yes
|
|
notify:
|
|
- relance isc-kea-ctrl-agent
|
|
|
|
- name: Generation du fichier de configuration kea-dhcp4.conf
|
|
ansible.builtin.template:
|
|
src: kea-dhcp4.conf.j2
|
|
dest: /etc/kea/kea-dhcp4.conf
|
|
backup: yes
|
|
notify:
|
|
- relance isc-kea-dhcp4-server
|
|
|
|
# - name: change adresse IP dans /etc/kea/kea-ctrl-agent.conf
|
|
# ansible.builtin.replace:
|
|
# path: /etc/kea/kea-ctrl-agent.conf
|
|
# regexp: '"http-host": "127.0.0.1",'
|
|
# replace: '"http-host": "{{ srv_ip }}",'
|
|
# backup: yes
|
|
#
|
|
- name: Preparation depot stork agent
|
|
ansible.builtin.shell: curl -1sLf 'https://dl.cloudsmith.io/public/isc/stork/cfg/setup/bash.deb.sh' | sudo bash
|
|
|
|
- name: Update apt
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
|
|
- name: Installation isc-stork-agent
|
|
ansible.builtin.apt:
|
|
name: isc-stork-agent
|
|
state: present
|
|
|
|
- name: Generation du fichier agent.env pour stork-agent
|
|
ansible.builtin.template:
|
|
src: agent.env.j2
|
|
dest: /etc/stork/agent.env
|
|
backup: yes
|
|
notify:
|
|
- relance isc-stork-agent
|
|
|
|
- name: Preparation stork agent
|
|
ansible.builtin.shell: sudo su stork-agent -s /bin/sh -c "stork-agent register --non-interactive --agent-host {{ srv_ip }} --server-url http://192.168.56.5:8080"
|
|
|
|
handlers:
|
|
- name: relance isc-kea-ctrl-agent
|
|
ansible.builtin.service:
|
|
name: isc-kea-ctrl-agent
|
|
state: restarted
|
|
enabled: yes
|
|
|
|
- name: relance isc-stork-agent
|
|
ansible.builtin.service:
|
|
name: isc-stork-agent
|
|
state: restarted
|
|
enabled: yes
|
|
|
|
|
|
- name: relance isc-kea-dhcp4-server
|
|
ansible.builtin.service:
|
|
name: isc-kea-dhcp4-server
|
|
state: restarted
|
|
enabled: yes
|
|
|
|
|