Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniyPatlan authored Feb 8, 2025
1 parent f54b55f commit bf90e75
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions build/packer/ansible/roles/ami-ovf/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@
- name: PMM | Delete Azure user
shell: cd /tmp; nohup sh -c "trap '/usr/sbin/waagent -force -deprovision+user && sync' EXIT; sleep 600" </dev/null >/dev/null 2>&1 &

- name: Create systemd unit to remove vagrant user after boot
copy:
dest: /etc/systemd/system/remove-vagrant.service
content: |
[Unit]
Description=Remove vagrant user after boot
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/userdel -r vagrant
ExecStart=/bin/rm -f /etc/sudoers.d/vagrant
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
owner: root
group: root
mode: '0644'
when: inventory_hostname in groups['virtualbox']

- name: Enable and start the remove-vagrant service
systemd:
name: remove-vagrant.service
enabled: yes
state: started
when: inventory_hostname in groups['virtualbox']

#- name: PMM | Delete vagrant
# shell: cd /tmp; nohup sh -c "trap 'userdel -r vagrant' EXIT; sleep 600"
# ignore_errors: yes

0 comments on commit bf90e75

Please sign in to comment.