diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-07-14 15:10:09 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-07-14 15:10:09 +0000 |
commit | 160fd3f2f1d372751836c0073bdc944df1cfbb91 (patch) | |
tree | d6b46ce1ec600400883e53b82e12b390fa73f262 /ansible/roles/trove-setup/tasks/gitano-setup.yml | |
parent | eafba37e2bfc3897e3e7f65f2ce087fbee358f43 (diff) | |
parent | d349c9a35d3d53ebfc9f26df373e84fa5986a1b6 (diff) | |
download | trove-setup-160fd3f2f1d372751836c0073bdc944df1cfbb91.tar.gz |
Merge branch 'baserock/pedroalvarez/trove-ansible3'
Reviewed-by: Richard Maw
Reviewed-by: Lars Wirzenius
Diffstat (limited to 'ansible/roles/trove-setup/tasks/gitano-setup.yml')
-rw-r--r-- | ansible/roles/trove-setup/tasks/gitano-setup.yml | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ansible/roles/trove-setup/tasks/gitano-setup.yml b/ansible/roles/trove-setup/tasks/gitano-setup.yml new file mode 100644 index 0000000..0fd3ba5 --- /dev/null +++ b/ansible/roles/trove-setup/tasks/gitano-setup.yml @@ -0,0 +1,45 @@ +# Depends on: +# - git.yml +--- +# Before configuring Gitano, it's necessary to modify the placeholders +# of the skeleton template of Gitano with the values of /etc/trove/trove.conf. +# Ansible does not provide an efficient way to do this. Its template module +# is not able to run recursively over directories, and is not able to create +# the directories needed. +# +# The solution implemented consists in create the directories first and then +# using the template module in all the files. This could be possible to +# implement using the 'with_lines' option combinated with the 'find' command. +# +# Create the directories +- name: Create the directories needed for the Gitano skeleton. + file: path=/etc/{{ item }} state=directory + with_lines: + - (cd /usr/share/trove-setup && find gitano -type d) +# Copy all the files to the right place and fill the templates whenever possible +- name: Create the Gitano skeleton using the templates + template: src=/usr/share/trove-setup/{{ item }} dest=/etc/{{ item }} + with_lines: + - (cd /usr/share/trove-setup && find gitano -type f) + +# Configure gitano +- name: Configure Gitano with /etc/gitano-setup.clod + shell: | + su git -c 'gitano-setup /etc/gitano-setup.clod' + creates=/home/git/repos/gitano-admin.git + +- name: Unlock the password of the git user (This task can fail) + shell: busybox passwd -u git + register: passwd_result + changed_when: passwd_result|success + ignore_errors: True + +# Now that /home/git/repos exists, we can enable the git-daemon service +- name: Enable the git-daemon.service + service: name=git-daemon.service enabled=yes + register: git_daemon_service + +# Now we can start the service without rebooting the system +- name: Restart git-daemon.service + service: name=git-daemon state=restarted + when: git_daemon_service|changed |