forked from dbw7/m3-one-click-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
equinix-playbook-main.yaml
123 lines (107 loc) · 4.26 KB
/
equinix-playbook-main.yaml
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
---
- name: Equinix Setup
hosts: localhost
become: true
tasks:
#Ignore this due to the comment below
- name: Update apt
apt:
upgrade: full
force_apt_get: yes
update_cache: yes
when: false
#Gonna keep this disabled for now as the shell script already does this
- name: Install git
apt:
name: git
state: present
#when: false
- name: create m3-demo directory
file:
path: "{{ ansible_env.HOME }}/m3-demo-parent"
state: directory
#when: false
- name: Clone m3-demo repo
shell: git clone https://github.com/dbw7/metal3-demo.git
args:
chdir: "{{ ansible_env.HOME }}/m3-demo-parent"
#when: false
- name: Add extra_vars.yml to m3-demo
copy:
src: "{{ ansible_env.HOME }}/ansible/extra_vars.yml"
dest: "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/extra_vars.yml"
- name: Replace baremetal repo url
ansible.builtin.lineinfile:
path: "{{ item }}"
regexp: '^\s*baremetal_repo_url:'
#line: 'baremetal_repo_url: https://github.com/guangyee/baremetal.git'
line: 'baremetal_repo_url: https://github.com/dbw7/charts.git'
loop:
- "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/baremetal/defaults/main.yml"
- "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/dnsmasq/defaults/main.yml"
- "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/media/defaults/main.yml"
- "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/powerdns/defaults/main.yml"
- name: Replace baremetal repo branch
ansible.builtin.lineinfile:
path: "{{ item }}"
regexp: '^\s*baremetal_branch:'
#line: 'baremetal_branch: pvc_for_ironic_only'
line: 'baremetal_branch: hardcoded-config'
loop:
- "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/baremetal/defaults/main.yml"
- "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/dnsmasq/defaults/main.yml"
- "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/media/defaults/main.yml"
- "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/powerdns/defaults/main.yml"
- name: Install Dependencies
apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- libvirt-clients
- qemu-kvm
- libvirt-daemon-system
- python3-pip
- pkg-config
- libvirt-dev # not sure about this one either
- mkisofs
- qemu # this may not be needed
- virtinst
- qemu-efi
- sshpass
#when: false
- name: Install ansible galaxy collections
command:
cmd: ansible-galaxy collection install -r requirements.yml
chdir: "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo"
become: yes
#when: false
- name: Install libvirt-python
ansible.builtin.pip:
name: libvirt-python
executable: pip3
- name: Define egress
become: yes
command: virsh net-define "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/libvirt/egress.xml"
- name: Start egress
become: yes
command: virsh net-start egress
- name: Define egress
become: yes
command: virsh net-define "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/libvirt/provisioning.xml"
- name: Start egress
become: yes
command: virsh net-start provisioning
#Replace OS Optimizations because ubuntu is really good and well updated thank you Ubuntu
- name: Replace OS Optimizations 1
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/vm/defaults/main.yml"
regexp: '^\s*cloud_image_os_name: opensuse15.4'
#line: 'baremetal_branch: pvc_for_ironic_only'
line: 'cloud_image_os_name: opensuse15.3'
- name: Replace OS Optimizations 2
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/m3-demo-parent/metal3-demo/roles/vm/defaults/main.yml"
regexp: '^\s*vm_os_variant: opensuse15.4'
#line: 'baremetal_branch: pvc_for_ironic_only'
line: 'vm_os_variant: opensuse15.3'