Delete a folder before recreating it with ansible-playbook
Last active
August 29, 2015 14:10
-
-
Save shurane/42e7b774f4d9db433e3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[defaults] | |
hostfile=hosts.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: machine | |
vars: | |
app_path: /tmp/dingus/ | |
env_user: vagrant | |
tasks: | |
- name: create inodes | |
file: > | |
dest={{ item.dest }} | |
state={{ item.state }} | |
owner={{ env_user }} | |
group={{ env_user }} | |
mode={{ item.mode }} | |
recurse={{ item.recurse }} | |
with_items: | |
- { dest: "{{ app_path }}", state: absent, mode: "0755", recurse: False } # delete file | |
- { dest: "{{ app_path }}", state: directory, mode: "0755", recurse: True } | |
#- file: > | |
#dest=/tmp/bower_components/ | |
#state=absent | |
#- copy: > | |
#src=bower_components/ | |
#dest=/tmp/bower_components/ | |
#- synchronize: > | |
#src=bower_components/ | |
#dest=/tmp/bower_components/ | |
#rsync_opts='-e "ssh -p 2222"' | |
# TODO | |
#- [ ] pm2 kill | |
#- [ ] file + copy module | |
#- [ ] otherwise synchronize module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[machine] | |
localhost ansible_ssh_port=2222 ansible_ssh_user=vagrant | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "hashicorp/precise64" | |
config.vm.provider "virtualbox" do |vb| | |
vb.customize ["modifyvm", :id, "--memory", "256"] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment