Created
October 23, 2013 19:40
-
-
Save ScottSturdivant/7125296 to your computer and use it in GitHub Desktop.
Using the git module in ansible to clone two repos into the same location. What should the expected outcome be? I would assume that the last git action to run would 'win'. In fact, nothing happens.
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: 127.0.0.1 | |
connection: local | |
vars: | |
clone_dest: '/tmp/ansible_clone' | |
version: 'devel' | |
tasks: | |
- name: Clone the ansible canonical repo into {{ clone_dest }} | |
git: repo=https://github.com/ansible/ansible.git | |
dest={{ clone_dest }} | |
version={{ version }} | |
- name: Clone a NEW repository into the same {{ clone_dest }} location | |
git: repo=https://github.com/SirScott/ansible.git | |
dest={{ clone_dest }} | |
version={{ version }} | |
- name: Clean up {{ clone_dest }} | |
command: rm -rf {{ clone_dest }} |
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
$ ansible-playbook -i hosts -v git_test.yml | |
PLAY [127.0.0.1] ************************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [127.0.0.1] | |
TASK: [Clone the ansible canonical repo into /tmp/ansible_clone] ************** | |
changed: [127.0.0.1] => {"after": "e34cde6bef26309919eb4da21c58a38b61770577", "before": null, "changed": true} | |
TASK: [Clone a NEW repository into the same /tmp/ansible_clone location] ****** | |
ok: [127.0.0.1] => {"after": "e34cde6bef26309919eb4da21c58a38b61770577", "before": "e34cde6bef26309919eb4da21c58a38b61770577", "changed": false} | |
TASK: [Clean up /tmp/ansible_clone] ******************************************* | |
changed: [127.0.0.1] => {"changed": true, "cmd": ["rm", "-rf", "/tmp/ansible_clone"], "delta": "0:00:00.017914", "end": "2013-10-23 13:38:47.240769", "rc": 0, "start": "2013-10-23 13:38:47.222855", "stderr": "", "stdout": ""} | |
PLAY RECAP ******************************************************************** | |
127.0.0.1 : ok=4 changed=2 unreachable=0 failed=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment