split ansible into roles
This commit is contained in:
parent
3544581bde
commit
97f93b02a8
10 changed files with 36 additions and 19 deletions
|
@ -1,4 +1,5 @@
|
|||
[defaults]
|
||||
roles_path=roles
|
||||
inventory=inventory
|
||||
interpreter_python=/usr/bin/python3
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
- hosts: all
|
||||
gather_facts: no
|
||||
tasks:
|
||||
|
||||
pre_tasks:
|
||||
- name: Wait for host to come up
|
||||
wait_for:
|
||||
state: started
|
||||
|
@ -28,19 +29,8 @@
|
|||
apt:
|
||||
pkg:
|
||||
- qemu-guest-agent
|
||||
- dnsmasq
|
||||
- dnsutils
|
||||
- name: Disable systemd-resolved
|
||||
systemd:
|
||||
name: systemd-resolved
|
||||
enabled: false
|
||||
state: stopped
|
||||
- name: Copy dnsmasq configuration
|
||||
copy:
|
||||
src: "dnsmasq.conf"
|
||||
dest: "/etc/dnsmasq.conf"
|
||||
- name: Enable dnsmasq
|
||||
systemd:
|
||||
name: dnsmasq
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
roles:
|
||||
- dnsmasq
|
||||
- nsd
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[targets]
|
||||
|
||||
192.168.30.7 ansible_connection=ssh ansible_user=root
|
1
ansible/inventory/host_vars/hermes.yml
Normal file
1
ansible/inventory/host_vars/hermes.yml
Normal file
|
@ -0,0 +1 @@
|
|||
internal_ip: 192.168.30.7
|
6
ansible/inventory/hosts.yml
Normal file
6
ansible/inventory/hosts.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
all:
|
||||
hosts:
|
||||
hermes:
|
||||
ansible_connection: ssh
|
||||
ansible_user: root
|
||||
ansible_host: 192.168.30.7
|
17
ansible/roles/dnsmasq/tasks/main.yml
Normal file
17
ansible/roles/dnsmasq/tasks/main.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
- name: Install dnsmasq
|
||||
apt:
|
||||
name: dnsmasq
|
||||
- name: Disable systemd-resolved
|
||||
systemd:
|
||||
name: systemd-resolved
|
||||
enabled: false
|
||||
state: stopped
|
||||
- name: Copy dnsmasq configuration
|
||||
copy:
|
||||
src: "{{ role_path }}/files/dnsmasq.conf"
|
||||
dest: "/etc/dnsmasq.conf"
|
||||
- name: Enable dnsmasq
|
||||
systemd:
|
||||
name: dnsmasq
|
||||
enabled: true
|
||||
state: started
|
0
ansible/roles/nsd/tasks/main.yml
Normal file
0
ansible/roles/nsd/tasks/main.yml
Normal file
1
main.tf
1
main.tf
|
@ -54,6 +54,7 @@ resource "libvirt_domain" "ubuntu" {
|
|||
|
||||
environment = {
|
||||
ANSIBLE_HOST_KEY_CHECKING = "False"
|
||||
ANSIBLE_CONFIG = "${var.ansible_cfg}"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,3 +23,7 @@ variable "ansible_inventory" {
|
|||
variable "ansible_playbook" {
|
||||
default = "ansible/hermes.yml"
|
||||
}
|
||||
|
||||
variable "ansible_cfg" {
|
||||
default = "ansible/ansible.cfg"
|
||||
}
|
||||
|
|
Reference in a new issue