Separate deploy and delete plays in different playbooks.
This commit is contained in:
parent
caf117750f
commit
f44e9648d3
@ -1,11 +1,8 @@
|
||||
# deploy then delete:
|
||||
# deploy:
|
||||
$ SECRETS_ARCHIVE_PASSPHRASE=XXXXXX ansible-playbook -e target_name=host.domain -e SECRET_HOST=host2.domain2 deploy_ovh_instance.yml
|
||||
|
||||
# only delete:
|
||||
$ SECRETS_ARCHIVE_PASSPHRASE=XXXXXX ansible-playbook -e target_name=host.domain -e SECRET_HOST=host2.domain2 -t delete deploy_ovh_instance.yml
|
||||
|
||||
# deploy and do not delete:
|
||||
$ SECRETS_ARCHIVE_PASSPHRASE=XXXXXX ansible-playbook -e target_name=host.domain -e SECRET_HOST=host2.domain2 -e delete=False deploy_ovh_instance.yml
|
||||
# delete:
|
||||
$ SECRETS_ARCHIVE_PASSPHRASE=XXXXXX ansible-playbook -e target_name=host.domain -e SECRET_HOST=host2.domain2 delete_ovh_instance.yml
|
||||
|
||||
library directory contains Ansible modules from https://github.com/gheesh/ansible-ovh-dns
|
||||
|
||||
|
15
delete_ovh_instance.yml
Normal file
15
delete_ovh_instance.yml
Normal file
@ -0,0 +1,15 @@
|
||||
- name: delete OVH instance
|
||||
hosts: localhost
|
||||
connection: local
|
||||
vars_files:
|
||||
- vars/main.yml
|
||||
tasks:
|
||||
- name: Retrieve secrets
|
||||
ansible.builtin.include_tasks: "tasks/retrieve_secret_vars.yml"
|
||||
|
||||
- name: Include OVH application credentials
|
||||
ansible.builtin.include_vars: "{{ remote_workdir }}/OVH_APPLICATION.yml"
|
||||
|
||||
- name: include role_delete_openstack_instance
|
||||
ansible.builtin.include_role:
|
||||
name: role_delete_openstack_instance
|
@ -171,23 +171,3 @@
|
||||
apply:
|
||||
tags: deploy_openvpn-server
|
||||
tags: deploy_openvpn-server
|
||||
|
||||
- name: delete OVH instance
|
||||
hosts: localhost
|
||||
connection: local
|
||||
tags: delete
|
||||
vars_files:
|
||||
- vars/main.yml
|
||||
tasks:
|
||||
- name: Retrieve secrets
|
||||
ansible.builtin.include_tasks: "tasks/retrieve_secret_vars.yml"
|
||||
when: delete | default(True) | bool
|
||||
|
||||
- name: Include OVH application credentials
|
||||
ansible.builtin.include_vars: "{{ remote_workdir }}/OVH_APPLICATION.yml"
|
||||
when: delete | default(True) | bool
|
||||
|
||||
- name: include role_delete_openstack_instance
|
||||
ansible.builtin.include_role:
|
||||
name: role_delete_openstack_instance
|
||||
when: delete | default(True) | bool
|
||||
|
Loading…
Reference in New Issue
Block a user