Commit f972a92 1 parent 79a2310 commit f972a92 Copy full SHA for f972a92
File tree 2 files changed +43
-3
lines changed
ansible/roles/ami-ovf/tasks
2 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,17 @@ fetch-el9:
22
22
-o ${PACKER_CACHE_DIR} /id_rsa_vagrant
23
23
chmod 600 ${PACKER_CACHE_DIR} /id_rsa_vagrant
24
24
test -f ${PACKER_CACHE_DIR} /box/oracle9.ova \
25
- || wget --progress=dot:giga https://vagrantcloud. com/bento/boxes/oracle-9.0/versions/202207.20.0/providers/virtualbox .box -O ${PACKER_CACHE_DIR} /box/oracle9.ova
25
+ || curl -fL https://pmm-build-cache.s3.us-east-2.amazonaws. com/VBOXES/oracle9-202407.23.0 .box -o ${PACKER_CACHE_DIR} /box/oracle9.ova
26
26
27
- # NOTE: image from vagrant registry is twice as large
28
27
test -f ${PACKER_CACHE_DIR}/box/box.ovf \
29
- || tar -C ${PACKER_CACHE_DIR}/box -xvf ${PACKER_CACHE_DIR}/box/oracle9.ova
28
+ || tar -C ${PACKER_CACHE_DIR}/box -xvf ${PACKER_CACHE_DIR}/box/oracle9.ova
29
+
30
+ # # Add the box using Vagrant
31
+ # test -f ${PACKER_CACHE_DIR}/box/box.ovf \
32
+ # || VAGRANT_HOME=${PACKER_CACHE_DIR}/box vagrant box add bento/oraclelinux-9 --box-version ${BOX_VERSION} --provider virtualbox
33
+
34
+ test -f ${PACKER_CACHE_DIR}/box/box.ovf \
35
+ || cp -rp ${PACKER_CACHE_DIR}/box/boxes/bento-VAGRANTSLASH-oraclelinux-9/${BOX_VERSION}/amd64/virtualbox/* ${PACKER_CACHE_DIR}/box
30
36
31
37
deps :
32
38
mkdir -p ${PACKER_CACHE_DIR} ~ /bin || :
Original file line number Diff line number Diff line change 103
103
104
104
- name : PMM | Delete Azure user
105
105
shell : cd /tmp; nohup sh -c "trap '/usr/sbin/waagent -force -deprovision+user && sync' EXIT; sleep 600" </dev/null >/dev/null 2>&1 &
106
+
107
+ - name : Lock vagrant user
108
+ ansible.builtin.user :
109
+ name : vagrant
110
+ password_lock : true
111
+ when : ansible_virtualization_type == "virtualbox"
112
+
113
+ - name : Configure systemd service to remove vagrant user
114
+ block :
115
+ - name : Create systemd service file
116
+ copy :
117
+ dest : /etc/systemd/system/remove-vagrant.service
118
+ content : |
119
+ [Unit]
120
+ Description=Remove vagrant user on first boot
121
+ After=multi-user.target
122
+
123
+ [Service]
124
+ Type=oneshot
125
+ ExecStart=/usr/sbin/userdel -r vagrant
126
+ ExecStartPost=/usr/bin/touch /etc/remove-vagrant-done
127
+
128
+ [Install]
129
+ WantedBy=multi-user.target
130
+ ConditionPathExists=!/etc/remove-vagrant-done
131
+
132
+ - name : Reload systemd to recognize the new service
133
+ command : systemctl daemon-reload
134
+
135
+ - name : Enable the remove-vagrant service
136
+ systemd :
137
+ name : remove-vagrant
138
+ enabled : true
139
+ when : ansible_virtualization_type == "virtualbox"
You can’t perform that action at this time.
0 commit comments