I am using Ansible to setup multiple test server environments (which are basically copies of same Git repository into test1-test55 different test folders).
Now, I'm able to create these folders recursively using the file module/package as follows
- name: Creating multiple test environments
file: dest=/var/www/test{{ item }} state=directory
with_sequence: start=1 end=55
But I'm not sure how to iterate using with_sequence so that the actual git clone task clones https://{{ githubuser | urlencode }}:{{ githubpassword | urlencode }}@github.com/abc/sample.git into test1,test2... test55 folders
I have this task to clone the git repo to a single folder/test environment
- name: Clone repo to the newly created test environments
git:
repo: "https://{{ githubuser | urlencode }}:{{ githubpassword | urlencode }}@github.com/ABC/sample.git"
dest: /var/www/test1/sample #This will clone sample.git to test1, have tried using item here but gives an error
#with_sequence: start=1 end=55 #This does not work
What changes should be made to the above task so that it can recursively clone the same repository to all 55 folders in single execution of the playbook
Any help would be appreciated.
Note: Organization and Repo names are for representational purposes only.