-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.yml
152 lines (130 loc) · 4.52 KB
/
setup.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
- hosts: localhost
connection: local
gather_facts: yes
become: yes
vars:
invoking_user: "{{ lookup('ansible.builtin.env', 'SUDO_USER', default=lookup('ansible.builtin.env', 'USER')) }}"
rockybox: https://dl.rockylinux.org/pub/rocky/9.3/images/x86_64/Rocky-9-Vagrant-Libvirt-9.3-20231113.0.x86_64.box
centosbox: https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-Vagrant-8-20240101.0.x86_64.vagrant-libvirt.box
tasks:
- name: Add hashicorp repo to system
ansible.builtin.get_url:
url: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
dest: /etc/yum.repos.d/hashicorp.repo
owner: root
group: root
mode: '0644'
- name: Install vagrant
ansible.builtin.dnf:
name: vagrant
state: present
- name: Enable the CRB repository (Rocky)
community.general.ini_file:
dest: /etc/yum.repos.d/rocky.repo
section: crb
option: enabled
value: 1
owner: root
group: root
mode: '0644'
when: ansible_distribution == "Rocky"
- name: Enable the CRB repository (Oracle)
community.general.ini_file:
dest: /etc/yum.repos.d/oracle-linux-ol9.repo
section: ol9_codeready_builder
option: enabled
value: 1
owner: root
group: root
mode: '0644'
when: ansible_distribution == "OracleLinux"
- name: Install libvirt-devel and libvirt
ansible.builtin.dnf:
name:
- libvirt-devel
- libvirt
state: present
- name: Start libvirtd
ansible.builtin.service:
name: libvirtd
state: started
- name: Enable libvirtd
ansible.builtin.service:
name: libvirtd
enabled: yes
- name: Install ruby and ruby-devel
ansible.builtin.dnf:
name:
- ruby
- ruby-devel
state: present
- name: Install "Development Tools" group
ansible.builtin.dnf:
name: '@Development Tools'
state: present
- name: Install "Virtualization Host" group
ansible.builtin.dnf:
name: '@Virtualization Host'
state: present
- name: Add invoking user to the libvirt group
ansible.builtin.user:
name: "{{ invoking_user }}"
groups: libvirt
append: yes
- name: Install vagrant-libvirt plugin
ansible.builtin.shell: "vagrant plugin install vagrant-libvirt"
changed_when: "1 != 1"
become: true
become_user: "{{ invoking_user }}"
- name: Add Rocky Linux 9.2 box to Vagrant
ansible.builtin.shell: "vagrant box add --name rockylinux/9 -f {{ rockybox }}"
changed_when: "1 != 1"
become: true
become_user: "{{ invoking_user }}"
- name: Add CentOS Stream 8 box to Vagrant
ansible.builtin.shell: "vagrant box add --name centos/stream8 -f {{ centosbox }}"
changed_when: "1 != 1"
become: true
become_user: "{{ invoking_user }}"
- name: Overwrite /etc/hosts
ansible.builtin.copy:
dest: "/etc/hosts"
owner: root
group: root
mode: '0644'
content: |
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.121.10 dns.oelabox.local
192.168.121.11 ipa.oelabox.local
192.168.121.12 koji.oelabox.local
- name: Install freeipa.ansible_freeipa collection
ansible.builtin.shell: "ansible-galaxy collection install freeipa.ansible_freeipa"
changed_when: "1 != 1"
become: true
become_user: "{{ invoking_user }}"
- name: Install git if it is not installed (by some means)
ansible.builtin.dnf:
name: git
state: present
- name: Install pandoc
ansible.builtin.dnf:
name: pandoc
state: present
- name: Clone ktdreyer.koji_ansible collection
ansible.builtin.git:
repo: 'https://github.com/ktdreyer/koji-ansible'
dest: /tmp/koji-ansible
become: true
become_user: "{{ invoking_user }}"
- name: Build ktdreyer.koji_ansible collection
ansible.builtin.shell: "/tmp/koji-ansible/build-collection"
changed_when: "1 != 1"
become: true
become_user: "{{ invoking_user }}"
- name: Install ktdreyer.koji_ansible collection
ansible.builtin.shell: "ansible-galaxy collection install /tmp/koji-ansible/_build"
changed_when: "1 != 1"
become: true
become_user: "{{ invoking_user }}"