From 17fe0fa65ff81ff39a99052e2aa08c6aec0227d6 Mon Sep 17 00:00:00 2001 From: tongliofcary Date: Mon, 26 Feb 2018 23:41:20 -0500 Subject: [PATCH] [CE-280] remove docker.io install Currently docker.io is installed which is quite old, ansible agent has been changed to install docker.ce, the cloud-init data file needs to be modified to reflect that change. Also we need to add functions to allow login to the docker repository when the repository requires login. Change-Id: I5e7eb2bcd40742b2988ab7f016eccfbdfe946532 Signed-off-by: tongliofcary --- src/agent/ansible/roles/cloud_aws/prepare/tasks/apply.yml | 2 +- .../ansible/roles/cloud_aws/prepare/tasks/destroy.yml | 2 +- .../ansible/roles/cloud_azure/prepare/tasks/apply.yml | 2 +- src/agent/ansible/roles/cloud_os/prepare/tasks/apply.yml | 2 +- src/agent/ansible/roles/cloud_os/prepare/tasks/destroy.yml | 2 +- .../ansible/roles/cloud_os/provision/templates/ubuntu.j2 | 1 - src/agent/ansible/roles/cloud_vb/prepare/tasks/main.yml | 4 ++-- .../roles/deploy_compose/fabricsetup/tasks/apply.yml | 7 +++++++ src/agent/ansible/vars/bc1st.yml | 4 +++- 9 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/agent/ansible/roles/cloud_aws/prepare/tasks/apply.yml b/src/agent/ansible/roles/cloud_aws/prepare/tasks/apply.yml index ae636cd58..d30d1d083 100755 --- a/src/agent/ansible/roles/cloud_aws/prepare/tasks/apply.yml +++ b/src/agent/ansible/roles/cloud_aws/prepare/tasks/apply.yml @@ -97,5 +97,5 @@ sg_id: "{{ vpcsg.security_groups[0].group_id }}" ami_id: "{{ (found_amis.results | first).ami_id }}" groups: "prohosts" - with_sequence: count={{ cluster.stack_size }} format=%03x + with_sequence: count={{ cluster.stack_size }} format=%03d no_log: True diff --git a/src/agent/ansible/roles/cloud_aws/prepare/tasks/destroy.yml b/src/agent/ansible/roles/cloud_aws/prepare/tasks/destroy.yml index cec19d4ac..60de26b3b 100755 --- a/src/agent/ansible/roles/cloud_aws/prepare/tasks/destroy.yml +++ b/src/agent/ansible/roles/cloud_aws/prepare/tasks/destroy.yml @@ -16,5 +16,5 @@ name: "{{ cluster.name_prefix }}{{ item }}" ansible_host: "127.0.0.1" groups: "prohosts" - with_sequence: count={{ cluster.stack_size }} format=%03x + with_sequence: count={{ cluster.stack_size }} format=%03d no_log: True diff --git a/src/agent/ansible/roles/cloud_azure/prepare/tasks/apply.yml b/src/agent/ansible/roles/cloud_azure/prepare/tasks/apply.yml index 6877262c6..01e68444c 100755 --- a/src/agent/ansible/roles/cloud_azure/prepare/tasks/apply.yml +++ b/src/agent/ansible/roles/cloud_azure/prepare/tasks/apply.yml @@ -88,7 +88,7 @@ name: "{{ cluster.name_prefix }}{{ item }}" ansible_host: "127.0.0.1" groups: prohosts - with_sequence: count={{ cluster.stack_size }} format=%03x + with_sequence: count={{ cluster.stack_size }} format=%03d - name: Scan the public key for master and added it to known hosts debug: "arggg {{ item }} " with_items: "{{ groups['prohosts'] }}" diff --git a/src/agent/ansible/roles/cloud_os/prepare/tasks/apply.yml b/src/agent/ansible/roles/cloud_os/prepare/tasks/apply.yml index f38f6235f..30a543e17 100755 --- a/src/agent/ansible/roles/cloud_os/prepare/tasks/apply.yml +++ b/src/agent/ansible/roles/cloud_os/prepare/tasks/apply.yml @@ -58,6 +58,6 @@ name: "{{ cluster.name_prefix }}{{ item }}" ansible_host: "127.0.0.1" groups: "prohosts" - with_sequence: count={{ cluster.stack_size }} format=%03x + with_sequence: count={{ cluster.stack_size }} format=%03d no_log: True diff --git a/src/agent/ansible/roles/cloud_os/prepare/tasks/destroy.yml b/src/agent/ansible/roles/cloud_os/prepare/tasks/destroy.yml index 2159752b4..932db2e63 100755 --- a/src/agent/ansible/roles/cloud_os/prepare/tasks/destroy.yml +++ b/src/agent/ansible/roles/cloud_os/prepare/tasks/destroy.yml @@ -4,5 +4,5 @@ name: "{{ cluster.name_prefix }}{{ item }}" ansible_host: "127.0.0.1" groups: "prohosts" - with_sequence: count={{ cluster.stack_size }} format=%03x + with_sequence: count={{ cluster.stack_size }} format=%03d no_log: True diff --git a/src/agent/ansible/roles/cloud_os/provision/templates/ubuntu.j2 b/src/agent/ansible/roles/cloud_os/provision/templates/ubuntu.j2 index a5ec54f2a..5b1532829 100755 --- a/src/agent/ansible/roles/cloud_os/provision/templates/ubuntu.j2 +++ b/src/agent/ansible/roles/cloud_os/provision/templates/ubuntu.j2 @@ -3,4 +3,3 @@ hostname: {{ inventory_hostname }}. package_update: true packages: - python - - docker.io diff --git a/src/agent/ansible/roles/cloud_vb/prepare/tasks/main.yml b/src/agent/ansible/roles/cloud_vb/prepare/tasks/main.yml index a82eeb18a..7e3804af1 100755 --- a/src/agent/ansible/roles/cloud_vb/prepare/tasks/main.yml +++ b/src/agent/ansible/roles/cloud_vb/prepare/tasks/main.yml @@ -12,7 +12,7 @@ sshport: "{{ initial_port | int + item | int }}" name: "{{ cluster.name_prefix }}{{ item }}" groups: "prohosts" - with_sequence: count={{ cluster.stack_size }} format=%03x + with_sequence: count={{ cluster.stack_size }} format=%03d - name: Add netprocessing host group add_host: @@ -22,5 +22,5 @@ ansible_ssh_pass: "{{ cluster.ssh_pass }}" name: "AA_{{ cluster.name_prefix }}{{ item }}" groups: "nathosts" - with_sequence: count={{ cluster.stack_size }} format=%03x + with_sequence: count={{ cluster.stack_size }} format=%03d when: mode == "apply" \ No newline at end of file diff --git a/src/agent/ansible/roles/deploy_compose/fabricsetup/tasks/apply.yml b/src/agent/ansible/roles/deploy_compose/fabricsetup/tasks/apply.yml index 7172d4ff9..677249164 100755 --- a/src/agent/ansible/roles/deploy_compose/fabricsetup/tasks/apply.yml +++ b/src/agent/ansible/roles/deploy_compose/fabricsetup/tasks/apply.yml @@ -194,6 +194,13 @@ set_fact: orgmembers: "{{ peers | map(attribute='org') | list | unique | sort | join(\".member' '\") | trim | replace(' ', ',') }}" +- name: Login to docker repo + command: docker login "{{ fabric.repo.url }} -u {{ fabric.repo.username }} -p {{ fabric.repo.password }}" + when: > + fabric.baseimage_tag | length > 0 and + fabric.repo.username | default("") | length > 0 and + fabric.repo.password | default("") | length > 0 + - name: Pull necessary container images from the docker hub command: "docker pull {{ fabric.repo.url }}{{ item.name }}" when: item.flag | length > 0 and fabric.baseimage_tag | length > 0 diff --git a/src/agent/ansible/vars/bc1st.yml b/src/agent/ansible/vars/bc1st.yml index e2b4a6394..d145dc29e 100755 --- a/src/agent/ansible/vars/bc1st.yml +++ b/src/agent/ansible/vars/bc1st.yml @@ -75,10 +75,12 @@ fabric: { # official hub - url: "hyperledger/", # fabric build hub - url: "nexus3.hyperledger.org:10001/hyperledger/", url: "hyperledger/", + username: "", + password: "", # locations to download fabric binaries. This url should point to a # compressed such as tar or zip file which contains necessary binaries # such as configtxgen, configtxlator, cryptogen etc. - bin: "https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric-build/linux-amd64-ff6f6dbffed57efb9f7d8886b4a47949ce2d4396/hyperledger-fabric-build-linux-amd64-ff6f6dbffed57efb9f7d8886b4a47949ce2d4396.tar.gz" + bin: "" } }