Commit 3ce1f6eb authored by Nick Busey's avatar Nick Busey

Uninstall fixes

parent 82cd9bf1
......@@ -23,7 +23,7 @@ git_sync:
@if [ -d settings/.git/ ]; then \
cd settings && \
echo "Git Sync:" && \
git pull && \
git pull 2>&1 && \
git add * > /dev/null 2>&1 && \
git commit -a -m "Settings update" > /dev/null 2>&1 ; \
git push > /dev/null 2>&1; \
......@@ -43,7 +43,8 @@ update: logo git_sync config
update_one: logo git_sync config
@ansible-playbook --extra-vars='{"services":["$(filter-out $@,$(MAKECMDGOALS))"]}' --extra-vars="@settings/config.yml" -i inventory -t deploy playbook.homelabos.yml
uninstall: logo git_sync config --extra-vars="@settings/config.yml" -i inventory -t deploy playbook.homelabos.yml
uninstall: logo #git_sync config
@ansible-playbook --extra-vars="@settings/config.yml" -i inventory -t deploy playbook.remove.yml
remove_one: logo git_sync config
@ansible-playbook --extra-vars='{"services":["$(filter-out $@,$(MAKECMDGOALS))"]}' --extra-vars="@settings/config.yml" -i inventory playbook.remove.yml
......
......@@ -3,6 +3,10 @@
become: "True"
gather_facts: "True"
tags: common
vars_prompt:
- name: confirm_remove
prompt: "Are you sure you wish to remove this service? (true/false)"
private: "False"
roles:
- homelabos_remove
......@@ -23,6 +23,7 @@
systemd:
name: "{{ item }}"
state: stopped
enabled: false
when: "not enabled_services[item]"
with_items:
- "{{ services }}"
......
---
- name: Read Tor SSH connection info
shell: cat /var/lib/tor/ssh-onion/hostname
register: tor_ssh_domain_file
when: enable_tor
- name: Read Tor connection info
shell: cat /var/lib/tor/http-onion/hostname
register: tor_http_domain_file
when: enable_tor
- name: remove enabled services.
file:
state: absent
path: "/var/homelabos/{{ service_item }}"
when: confirm_remove
loop: "{{ services|flatten(levels=1) }}"
loop_control:
loop_var: service_item
- name: Ensure disabled services are not running
systemd:
name: "{{ item }}"
state: stopped
enabled: false
when: "not enabled_services[item] and confirm_remove"
with_items:
- "{{ services }}"
ignore_errors: "yes"
- name: remove enabled services.
file:
state: absent
path: "/var/homelabos/{{service_item}}"
when: "enabled_services[service_item]"
path: "/etc/systemd/system/{{ service_item }}.service"
when: confirm_remove
loop: "{{ services|flatten(levels=1) }}"
loop_control:
loop_var: service_item
vars:
tor_domain: "{{ tor_http_domain_file.stdout | default('') }}"
- debug:
- when: confirm_remove
debug:
msg: "Package removed successfully! Go to https://{{ domain }}/ to get started."
- debug:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment