-
Notifications
You must be signed in to change notification settings - Fork 39
/
01_install_virtualization_tools.yml
68 lines (61 loc) · 2.13 KB
/
01_install_virtualization_tools.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
- name: This play installs needed tools to provision infrastructure VMs
hosts: vm_host
vars_files:
- vars/cluster_vars.yml
- vars/infra_vars.yml
become: true
tasks:
- name: Install needed packages
ansible.builtin.yum:
name: "{{ virtualization_packages.rhel }}"
state: latest # noqa package-latest
when:
- ansible_distribution == 'RedHat'
- name: Install needed packages
ansible.builtin.yum:
name: "{{ virtualization_packages.centos }}"
state: latest # noqa package-latest
when:
- ansible_distribution == 'CentOS'
- name: Install needed packages
ansible.builtin.yum:
name: "{{ virtualization_packages.fedora }}"
state: latest # noqa package-latest
when:
- ansible_distribution == 'Fedora'
- name: Download and provision Terraform
ansible.builtin.unarchive:
src: "{{ terraform_release_url }}"
dest: /usr/bin/
mode: "0755"
remote_src: true
- name: Virtualization services are enabled
ansible.builtin.service:
name: libvirtd
state: started
enabled: true
when: ansible_distribution != 'CentOS' or
(ansible_distribution == 'CentOS' and ansible_distribution_major_version | int == 8)
- name: Virtualization services are enabled
ansible.builtin.service:
name: virtqemud
state: started
enabled: true
when:
- ansible_distribution == 'CentOS'
- ansible_distribution_major_version | int == 9
- name: Ensuring libvirt module is present
ansible.builtin.pip:
name: libvirt-python
become: true
- name: Use TF project to ensure pool and network are defined
community.general.terraform:
project_path: "{{ workspace_directory.base_path }}/{{ cluster.name }}/terraform/libvirt-resources"
variables:
dns: "{{ infra_nodes.host_list.bastion[0].ip }}"
domain: "{{ cluster.name }}.{{ domain }}"
network_cidr: ' ["{{ network_cidr }}"]'
cluster_name: "{{ cluster.name }}"
force_init: true
state: present