Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/ansible/roles/trove-setup/tasks/check.yml b/ansible/roles/trove-setup/tasks/check.yml
- index 7da6a57..d873030 100644
- --- a/ansible/roles/trove-setup/tasks/check.yml
- +++ b/ansible/roles/trove-setup/tasks/check.yml
- @@ -42,7 +42,7 @@
- when: MASON_PORT is not defined
- - name: Calculate ESC_PREFIX
- - shell: echo -n {{ TROVE_ID | quote }} | perl -pe 's/([-+\(\).%*?^$\[\]])/%$1/g'
- + shell: echo -n {{ TROVE_ID|quote }} | perl -pe 's/([-+\(\).%*?^$\[\]])/%$1/g'
- register: var_esc_prefix
- changed_when: False
- @@ -62,9 +62,9 @@
- - name: Check if the ssh keys are unique
- shell: |
- - cat {{ TROVE_ADMIN_SSH_PUBKEY | quote}} \
- - {{ LORRY_SSH_PUBKEY | quote }} \
- - {{ WORKER_SSH_PUBKEY | quote }} \
- + cat {{ TROVE_ADMIN_SSH_PUBKEY|quote}} \
- + {{ LORRY_SSH_PUBKEY|quote }} \
- + {{ WORKER_SSH_PUBKEY|quote }} \
- | cut -d ' ' -f 1,2 | sort -u | wc -l
- changed_when: False
- register: number_ssh_keys
- diff --git a/ansible/roles/trove-setup/tasks/gitano-admin-setup.yml b/ansible/roles/trove-setup/tasks/gitano-admin-setup.yml
- index 59a7685..c4c3eb2 100644
- --- a/ansible/roles/trove-setup/tasks/gitano-admin-setup.yml
- +++ b/ansible/roles/trove-setup/tasks/gitano-admin-setup.yml
- @@ -2,27 +2,27 @@
- # - gitano-setup.yml
- ---
- - name: Check if the admin user is configured in gitano (This task can fail)
- - shell: su git -c 'ssh git@localhost user' | grep '^{{ TROVE_ADMIN_USER | regex_replace('(\\W)', '\\\\\\1') }}:'
- + shell: su git -c 'ssh git@localhost user' | grep '^'{{ TROVE_ADMIN_USER|regex_replace('(\\W)', '\\\\\\1')|quote}}':'
- register: gitano_admin_user
- changed_when: False
- ignore_errors: True
- # If the admin user doesn't exist
- - name: Create the admin user
- - shell: su git -c 'ssh git@localhost user add {{ TROVE_ADMIN_USER | quote}} {{ TROVE_ADMIN_EMAIL | quote }} {{ TROVE_ADMIN_NAME | quote }}'
- + shell: su git -c 'ssh git@localhost user add '{{ TROVE_ADMIN_USER|quote|quote|quote}}' '{{ TROVE_ADMIN_EMAIL|quote|quote|quote }}' '{{ TROVE_ADMIN_NAME|quote|quote|quote }}
- when: gitano_admin_user|failed
- - name: Check if admin user is in trove-admin group in gitano (This task can fail)
- - shell: su git -c 'ssh git@localhost as {{ TROVE_ADMIN_USER | quote }} whoami' | grep 'trove-admin. Trove-local administration'
- + shell: su git -c 'ssh git@localhost as '{{ TROVE_ADMIN_USER|quote|quote|quote }}' whoami' | grep 'trove-admin. Trove-local administration'
- register: gitano_admin_group
- changed_when: False
- ignore_errors: True
- # If the admin user is not in the trove-admin group
- - name: Add the admin user to the trove-admin group in gitano
- - shell: su git -c 'ssh git@localhost group adduser trove-admin {{ TROVE_ADMIN_USER | quote }}'
- + shell: su git -c 'ssh git@localhost group adduser trove-admin '{{ TROVE_ADMIN_USER|quote|quote|quote }}
- when: gitano_admin_group|failed
- - name: Check if admin user has a sshkey configured in gitano (This task can fail)
- - shell: su git -c 'ssh git@localhost as {{ TROVE_ADMIN_USER | quote }} sshkey' 2>&1 | grep WARNING
- + shell: su git -c 'ssh git@localhost as '{{ TROVE_ADMIN_USER|quote|quote|quote }}' sshkey' 2>&1 | grep WARNING
- register: gitano_admin_key
- changed_when: False
- ignore_errors: True
- @@ -35,5 +35,5 @@
- when: gitano_admin_key|success
- - name: Add /home/git/keys/admin.key.pub ssh key to the admin user in gitano.
- - shell: su git -c 'ssh git@localhost as {{ TROVE_ADMIN_USER | quote }} sshkey add default < /home/git/keys/admin.key.pub'
- + shell: su git -c 'ssh git@localhost as '{{ TROVE_ADMIN_USER|quote|quote|quote}}' sshkey add default < /home/git/keys/admin.key.pub'
- when: gitano_admin_key|success
- diff --git a/ansible/roles/trove-setup/tasks/hostname.yml b/ansible/roles/trove-setup/tasks/hostname.yml
- index 6a2021b..b43284b 100644
- --- a/ansible/roles/trove-setup/tasks/hostname.yml
- +++ b/ansible/roles/trove-setup/tasks/hostname.yml
- @@ -2,7 +2,7 @@
- # - check.yml
- ---
- - name: Check the /etc/hostname and compare it with HOSTNAME (This task can fail)
- - shell: su -c '[ "$(cat /etc/hostname)" == {{ HOSTNAME | quote }} ]'
- + shell: su -c '[ "$(cat /etc/hostname)" == "'{{ HOSTNAME|quote }}'" ]'
- register: hostname_file
- ignore_errors: True
- changed_when: False
- @@ -10,11 +10,11 @@
- # If /etc/hostname doesn't match with HOSTNAME
- - name: Rewrite /etc/hostname with HOSTNAME
- - shell: echo {{ HOSTNAME | quote }} > /etc/hostname
- + shell: echo {{ HOSTNAME|quote }} > /etc/hostname
- when: hostname_file|failed
- - name: Check the actual hostname with `hostname` and compare it with HOSTNAME (This task can fail)
- - shell: sh -c '[ "$(hostname)" == {{ HOSTNAME | quote}} ]'
- + shell: sh -c '[ "$(hostname)" == "'{{ HOSTNAME|quote}}'" ]'
- register: actual_hostname
- ignore_errors: True
- changed_when: False
- @@ -22,5 +22,5 @@
- # If `hostname` doesn't match with HOSTNAME
- - name: Change the hostname to HOSTNAME
- - shell: hostname {{ HOSTNAME | quote }}
- + shell: hostname {{ HOSTNAME|quote }}
- when: actual_hostname|failed
- diff --git a/ansible/roles/trove-setup/tasks/known-hosts-setup.yml b/ansible/roles/trove-setup/tasks/known-hosts-setup.yml
- index 7ebc0f7..6e988e0 100644
- --- a/ansible/roles/trove-setup/tasks/known-hosts-setup.yml
- +++ b/ansible/roles/trove-setup/tasks/known-hosts-setup.yml
- @@ -3,5 +3,5 @@
- ---
- - name: Add localhost and UPSTREAM_TROVE to /etc/ssh/ssh_known_hosts
- shell: |
- - ssh-keyscan localhost {{ UPSTREAM_TROVE | quote }} > /etc/ssh/ssh_known_hosts
- + ssh-keyscan localhost {{ UPSTREAM_TROVE|quote }} > /etc/ssh/ssh_known_hosts
- creates=/etc/ssh/ssh_known_hosts
- diff --git a/ansible/roles/trove-setup/tasks/lorry-controller-setup.yml b/ansible/roles/trove-setup/tasks/lorry-controller-setup.yml
- index 5f5cfbd..6ef321c 100644
- --- a/ansible/roles/trove-setup/tasks/lorry-controller-setup.yml
- +++ b/ansible/roles/trove-setup/tasks/lorry-controller-setup.yml
- @@ -4,7 +4,7 @@
- ---
- - name: Create the TROVE_ID/local-config/lorries repository
- shell: |
- - su git -c "ssh localhost create {{ TROVE_ID | quote }}/local-config/lorries"
- + su git -c 'ssh localhost create '{{ TROVE_ID|quote }}'/local-config/lorries'
- creates=/home/git/repos/{{ TROVE_ID }}/local-config/lorries.git
- - name: Create a temporary folder to copy templates
- shell: su git -c 'mktemp -d'
- @@ -21,15 +21,15 @@
- - name: Configure the lorry-controller
- shell: |
- - su git -c "git clone ssh://localhost/{{ TROVE_ID | quote }}/local-config/lorries.git {{ lorry_controller_repository.stdout }}/lorries"
- - su git -c "cp {{ lorry_controller_templates.stdout }}/lorry-controller.conf {{ lorry_controller_repository.stdout }}/lorries/lorry-controller.conf"
- - su git -c "cp {{ lorry_controller_templates.stdout }}/README.lorry-controller {{ lorry_controller_repository.stdout }}/lorries/README"
- - su git -c "mkdir {{ lorry_controller_repository.stdout }}/lorries//open-source-lorries"
- - su git -c "cp /usr/share/trove-setup/open-source-lorries/README {{ lorry_controller_repository.stdout }}/lorries/open-source-lorries/README"
- - su git -c "mkdir {{ lorry_controller_repository.stdout }}/lorries/closed-source-lorries"
- - su git -c "cp /usr/share/trove-setup/closed-source-lorries/README {{ lorry_controller_repository.stdout }}/lorries/closed-source-lorries/README"
- - su git -c "cd {{ lorry_controller_repository.stdout }}/lorries; git add README lorry-controller.conf open-source-lorries/README closed-source-lorries/README; git commit -m 'Initial configuration'; git push origin master"
- - su git -c "rm -rf {{ lorry_controller_repository.stdout }}"
- + su git -c 'git clone ssh://localhost/'{{ TROVE_ID|quote|quote }}'/local-config/lorries.git '{{ lorry_controller_repository.stdout|quote|quote }}'/lorries'
- + su git -c 'cp '{{ lorry_controller_templates.stdout|quote|quote }}'/lorry-controller.conf '{{ lorry_controller_repository.stdout|quote|quote }}'/lorries/lorry-controller.conf'
- + su git -c 'cp '{{ lorry_controller_templates.stdout|quote|quote }}'/README.lorry-controller '{{ lorry_controller_repository.stdout|quote|quote }}'/lorries/README'
- + su git -c 'mkdir '{{ lorry_controller_repository.stdout|quote|quote }}'/lorries/open-source-lorries'
- + su git -c 'cp /usr/share/trove-setup/open-source-lorries/README '{{ lorry_controller_repository.stdout|quote|quote }}'/lorries/open-source-lorries/README'
- + su git -c 'mkdir '{{ lorry_controller_repository.stdout|quote|quote }}'/lorries/closed-source-lorries'
- + su git -c 'cp /usr/share/trove-setup/closed-source-lorries/README '{{ lorry_controller_repository.stdout|quote|quote }}'/lorries/closed-source-lorries/README'
- + su git -c 'cd '{{ lorry_controller_repository.stdout|quote|quote }}'/lorries; git add README lorry-controller.conf open-source-lorries/README closed-source-lorries/README; git commit -m "Initial configuration"; git push origin master'
- + su git -c 'rm -rf '{{ lorry_controller_repository.stdout|quote|quote }}
- creates=/home/git/repos/{{ TROVE_ID }}/local-config/lorries.git/refs/heads/master
- # Migration: Remove the old lorry-controller cronjob if exists
- diff --git a/ansible/roles/trove-setup/tasks/releases.yml b/ansible/roles/trove-setup/tasks/releases.yml
- index 565f10c..2c20c6f 100644
- --- a/ansible/roles/trove-setup/tasks/releases.yml
- +++ b/ansible/roles/trove-setup/tasks/releases.yml
- @@ -3,7 +3,7 @@
- ---
- - name: Create the releases repository
- shell: |
- - su git -c 'ssh localhost create {{ TROVE_ID | quote }}/site/releases'
- + su git -c 'ssh localhost create '{{ TROVE_ID|quote|quote|quote }}'/site/releases'
- creates=/home/git/repos/{{ TROVE_ID }}/site/releases.git
- - name: Create temporary folder to copy templates
- @@ -17,10 +17,10 @@
- register: releases_repository
- - name: Configure the releases repository
- shell: |
- - su git -c "git clone ssh://localhost/{{ TROVE_ID | quote }}/site/releases.git {{ releases_repository.stdout }}/releases"
- - su git -c "cp {{ releases_templates.stdout }}/releases-repo-README {{ releases_repository.stdout }}/releases/README"
- - su git -c "cd {{ releases_repository.stdout }}/releases; git add README; git commit -m 'Add README'; git push origin master"
- - su -c "rm -Rf {{ releases_repository.stdout }}"
- + su git -c 'git clone ssh://localhost/'{{ TROVE_ID|quote|quote }}'/site/releases.git '{{ releases_repository.stdout|quote|quote }}'/releases'
- + su git -c 'cp '{{ releases_templates.stdout|quote|quote }}'/releases-repo-README '{{ releases_repository.stdout|quote|quote }}'/releases/README'
- + su git -c 'cd '{{ releases_repository.stdout|quote|quote }}'/releases; git add README; git commit -m "Add README"; git push origin master'
- + su -c "rm -Rf {{ releases_repository.stdout|quote|quote }}"
- creates=/home/git/repos/{{ TROVE_ID }}/site/releases.git/refs/heads/master
- - name: Link the releases repository to enable the access throught browser
- diff --git a/ansible/roles/trove-setup/tasks/site-groups.yml b/ansible/roles/trove-setup/tasks/site-groups.yml
- index 14d0153..e4aff14 100644
- --- a/ansible/roles/trove-setup/tasks/site-groups.yml
- +++ b/ansible/roles/trove-setup/tasks/site-groups.yml
- @@ -3,7 +3,7 @@
- ---
- # First of all check if the site groups are created.
- - name: Check for site groups (This task can fail)
- - shell: su git -c 'ssh git@localhost group list' | grep '^{{ item.name }}:'
- + shell: su git -c 'ssh git@localhost group list' | grep '^'{{ item.name|quote }}':'
- changed_when: False
- ignore_errors: True
- with_items:
- @@ -67,13 +67,13 @@
- # }
- - name: Create the site groups needed.
- - shell: su git -c 'ssh git@localhost group add {{ item.item.name }} {{ item.item.description }}'
- + shell: su git -c 'ssh git@localhost group add '{{ item.item.name|quote|quote|quote }}' '{{ item.item.description|quote|quote|quote }}
- when: item|failed
- with_items: gitano_groups.results
- # When the groups are created, check if they are linked.
- - name: Check for linked groups (This task can fail)
- - shell: su git -c 'ssh git@localhost group show {{ item.name }}' | grep '^ \[] {{ item.super_group }}'
- + shell: su git -c 'ssh git@localhost group show '{{ item.name|quote|quote|quote }} | grep '^ \[] '{{ item.super_group|quote }}
- changed_when: False
- ignore_errors: True
- with_items:
- @@ -83,6 +83,6 @@
- register: gitano_linked_groups
- # Link the groups that weren't linked following the same strategy as for the groups
- -- shell: su git -c 'ssh git@localhost group addgroup {{ item.item.name }} {{ item.item.super_group }}'
- +- shell: su git -c 'ssh git@localhost group addgroup '{{ item.item.name|quote|quote|quote }}' '{{ item.item.super_group|quote|quote|quote }}
- when: item|failed
- with_items: gitano_linked_groups.results
- diff --git a/ansible/roles/trove-setup/tasks/users.yml b/ansible/roles/trove-setup/tasks/users.yml
- index 272fb77..c1ab866 100644
- --- a/ansible/roles/trove-setup/tasks/users.yml
- +++ b/ansible/roles/trove-setup/tasks/users.yml
- @@ -15,7 +15,7 @@
- - name: Create known_hosts for all the users
- shell: |
- cat /etc/ssh/ssh_host_*_key.pub | cut -d\ -f1,2 | \
- - sed -e"s/^/{{ TROVE_HOSTNAME | regex_replace('(\\W)', '\\\\\\1') }},localhost /" > \
- + sed -e's/^/'{{ TROVE_HOSTNAME|regex_replace('(\\W)', '\\\\\\1')|quote }}',localhost /' > \
- /home/{{ item }}/.ssh/known_hosts
- chown {{ item }}:{{ item }} /home/{{ item }}/.ssh/known_hosts
- chmod 600 /home/{{ item }}/.ssh/known_hosts
Advertisement
Add Comment
Please, Sign In to add comment