Update mirrors from apt to mirror.mirantis.com

Change-Id: I856859a7bf2a1cc2d12fcb965e3b69c2a580cd2f
diff --git a/common/ubuntu_salt_bootstrap.sh b/common/ubuntu_salt_bootstrap.sh
index e0e5ff4..4b24c27 100644
--- a/common/ubuntu_salt_bootstrap.sh
+++ b/common/ubuntu_salt_bootstrap.sh
@@ -9,13 +9,13 @@
 MCP_VERSION=${MCP_VERSION:-testing}
 SALTSTACK_GPG=${SALTSTACK_GPG:-"https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"}
 SALTSTACK_REPO=${SALTSTACK_REPO:-"http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7 xenial main"}
-APT_MIRANTIS_GPG=${APT_MIRANTIS_GPG:-"http://apt.mirantis.com/public.gpg"}
-APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $MCP_VERSION salt"}
+APT_MIRANTIS_SALT_GPG=${APT_MIRANTIS_SALT_GPG:-"http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial/archive-salt-formulas.key"}
+APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"deb [arch=amd64] http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial xenial main"}
 
 function process_repos(){
 # TODO: those  should be unhardcoded and re-writed, using CC model
 wget -O - ${SALTSTACK_GPG} | sudo apt-key add -
-wget -O - ${APT_MIRANTIS_GPG} | apt-key add -
+wget -O - ${APT_MIRANTIS_SALT_GPG} | apt-key add -
 wget -O - http://mirror.mirantis.com/${MCP_VERSION}/extra/xenial/archive-extra.key | apt-key add -
 
 echo "deb [arch=amd64] ${SALTSTACK_REPO}"  > /etc/apt/sources.list.d/mcp_saltstack.list
@@ -64,7 +64,7 @@
 export DOMAIN="${CLUSTER_NAME}.local"
 export EXTRA_FORMULAS=${EXTRA_FORMULAS:-"aptly docker gerrit git iptables jenkins keycloak logrotate maas ntp nginx openldap sphinx"}
 export APT_REPOSITORY=" deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO} "
-export APT_REPOSITORY_GPG=${APT_MIRANTIS_GPG}
+export APT_REPOSITORY_GPG=${APT_MIRANTIS_SALT_GPG}
 export SALT_STOPSTART_WAIT=${SALT_STOPSTART_WAIT:-10}
 echo "INFO: build in offline build!"
 export BOOTSTRAP_SALTSTACK_COM=${BOOTSTRAP_SALTSTACK_COM:-"file:///tmp/bootstrap.saltstack.com.sh"}
diff --git a/day01-image/run.example.sh b/day01-image/run.example.sh
index 16c1d03..4ad15c5 100755
--- a/day01-image/run.example.sh
+++ b/day01-image/run.example.sh
@@ -15,15 +15,15 @@
 #
 export CLUSTER_MODEL="http://gerrit.mcp.mirantis.com/mcp/mcp-drivetrain-model"
 export CLUSTER_MODEL_REF="master"
-export MCP_VERSION=proposed
-export SCRIPTS_REF=master
-export CLUSTER_NAME=mcp-day01
-export UBUNTU_BASEURL="http://mirror.mirantis.com/proposed/ubuntu/"
-export SALTSTACK_REPO="http://mirror.mirantis.com/proposed/saltstack-2017.7/xenial xenial main"
-export APT_MIRANTIS_GPG="http://apt.mirantis.com/public.gpg"
+export CLUSTER_NAME="mcp-day01"
+export MCP_VERSION="proposed"
+export SALTSTACK_REPO="http://mirror.mirantis.com/${MCP_VERSION}/saltstack-2017.7/xenial xenial main"
 export SALTSTACK_GPG="https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"
-export APT_MIRANTIS_SALT_REPO="http://apt.mirantis.com/xenial/ proposed salt"
+export APT_MIRANTIS_SALT_REPO="http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial xenial main"
+export APT_MIRANTIS_SALT_GPG="http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial/archive-salt-formulas.key"
 export GIT_SALT_FORMULAS_SCRIPTS="https://gerrit.mcp.mirantis.com/salt-formulas/salt-formulas-scripts"
+export SCRIPTS_REF="master"
+export UBUNTU_BASEURL="http://mirror.mirantis.com/${MCP_VERSION}/ubuntu/"
 ###
 # Hard-coded folder in template
 export PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/"
diff --git a/day01-image/scripts/salt.sh b/day01-image/scripts/salt.sh
index 25fda6e..7ec442a 100644
--- a/day01-image/scripts/salt.sh
+++ b/day01-image/scripts/salt.sh
@@ -1,7 +1,7 @@
 #!/bin/bash -xe
 
 MCP_VERSION=${MCP_VERSION:-proposed}
-APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $MCP_VERSION salt"}
+APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial xenial main"}
 SALT_OPTS="-t 10 --retcode-passthrough --no-color"
 
 echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list
diff --git a/day01-image/template.json b/day01-image/template.json
index 455ed14..a862869 100644
--- a/day01-image/template.json
+++ b/day01-image/template.json
@@ -14,7 +14,7 @@
     "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
     "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
     "saltstack_repo": "{{ env `SALTSTACK_REPO` }}",
-    "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_GPG` }}",
+    "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_SALT_GPG` }}",
     "apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}",
     "git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}"
   },
@@ -53,7 +53,7 @@
         "BS_HOSTNAME={{ user `bs_hostname` }}",
         "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
         "SALTSTACK_REPO={{ user `saltstack_repo` }}",
-        "APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}",
+        "APT_MIRANTIS_SALT_GPG={{ user `apt_mirantis_gpg` }}",
         "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
         "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}",
         "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
diff --git a/mirror-image/run.example.sh b/mirror-image/run.example.sh
index 2a1a42c..5839cb2 100755
--- a/mirror-image/run.example.sh
+++ b/mirror-image/run.example.sh
@@ -25,8 +25,8 @@
 export UBUNTU_BASEURL="http://mirror.mirantis.com/${BINARY_MCP_VERSION}/ubuntu/"
 export SALTSTACK_REPO="http://mirror.mirantis.com/${BINARY_MCP_VERSION}/saltstack-2017.7/xenial xenial main"
 export SALTSTACK_GPG="http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"
-export APT_MIRANTIS_GPG="http://apt.mirantis.com/public.gpg"
-export APT_MIRANTIS_SALT_REPO="http://apt.mirantis.com/xenial/ ${BINARY_MCP_VERSION} salt "
+export APT_MIRANTIS_SALT_GPG="http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial/archive-salt-formulas.key"
+export APT_MIRANTIS_SALT_REPO="http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial xenial main"
 #
 export GIT_SALT_FORMULAS_SCRIPTS="https://gerrit.mcp.mirantis.com/salt-formulas/salt-formulas-scripts"
 export SCRIPTS_REF="master"
diff --git a/mirror-image/template.json b/mirror-image/template.json
index 4469b8a..f7e668b 100644
--- a/mirror-image/template.json
+++ b/mirror-image/template.json
@@ -14,7 +14,7 @@
     "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
     "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
     "saltstack_repo": "{{ env `SALTSTACK_REPO` }}",
-    "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_GPG` }}",
+    "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_SALT_GPG` }}",
     "apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}",
     "git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}",
     "os_flavor": "27574e15-f031-4b78-a82d-4cef3aea9442",
@@ -53,7 +53,7 @@
         "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}",
         "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
         "SALTSTACK_REPO={{ user `saltstack_repo` }}",
-        "APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}",
+        "APT_MIRANTIS_SALT_GPG={{ user `apt_mirantis_gpg` }}",
         "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
         "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}",
         "PACKER_OFFLINE_BUILD=true"
diff --git a/trymcp-day01-image/run.example.sh b/trymcp-day01-image/run.example.sh
index 3b78bdf..b2b02e5 100755
--- a/trymcp-day01-image/run.example.sh
+++ b/trymcp-day01-image/run.example.sh
@@ -13,17 +13,17 @@
 #
 export IMAGE_NAME="trymcp"
 #
-export APT_MIRANTIS_GPG="http://apt.mirantis.com/public.gpg"
-export APT_MIRANTIS_SALT_REPO="http://apt.mirantis.com/xenial/ nightly salt"
 export CLUSTER_MODEL="https://gerrit.mcp.mirantis.com/trymcp/drivetrain-model"
 export CLUSTER_MODEL_REF="master"
 export CLUSTER_NAME="try-mcp"
-export GIT_SALT_FORMULAS_SCRIPTS="https://gerrit.mcp.mirantis.com/salt-formulas/salt-formulas-scripts"
 export MCP_VERSION="proposed"
+export SALTSTACK_REPO="http://mirror.mirantis.com/${MCP_VERSION}/saltstack-2017.7/xenial xenial main"
 export SALTSTACK_GPG="https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"
-export SALTSTACK_REPO="http://mirror.mirantis.com/proposed/saltstack-2017.7/xenial xenial main"
+export APT_MIRANTIS_SALT_REPO="http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial xenial main"
+export APT_MIRANTIS_SALT_GPG="http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial/archive-salt-formulas.key"
+export GIT_SALT_FORMULAS_SCRIPTS="https://gerrit.mcp.mirantis.com/salt-formulas/salt-formulas-scripts"
 export SCRIPTS_REF="master"
-export UBUNTU_BASEURL="http://mirror.mirantis.com/proposed/ubuntu/"
+export UBUNTU_BASEURL="http://mirror.mirantis.com/${MCP_VERSION}/ubuntu/"
 
 ###
 # Hard-coded folder in template
diff --git a/trymcp-day01-image/scripts/salt.sh b/trymcp-day01-image/scripts/salt.sh
index 2161aaf..c0bb21a 100644
--- a/trymcp-day01-image/scripts/salt.sh
+++ b/trymcp-day01-image/scripts/salt.sh
@@ -1,7 +1,7 @@
 #!/bin/bash -xe
 
 MCP_VERSION=${MCP_VERSION:-proposed}
-APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $MCP_VERSION salt"}
+APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial xenial main"}
 SALT_OPTS="-t 10 --retcode-passthrough --no-color"
 
 echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list
diff --git a/trymcp-day01-image/template.json b/trymcp-day01-image/template.json
index aba2b31..021c13f 100644
--- a/trymcp-day01-image/template.json
+++ b/trymcp-day01-image/template.json
@@ -14,7 +14,7 @@
     "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
     "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
     "saltstack_repo": "{{ env `SALTSTACK_REPO` }}",
-    "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_GPG` }}",
+    "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_SALT_GPG` }}",
     "apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}",
     "git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}"
   },
@@ -53,7 +53,7 @@
         "BS_HOSTNAME={{ user `bs_hostname` }}",
         "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
         "SALTSTACK_REPO={{ user `saltstack_repo` }}",
-        "APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}",
+        "APT_MIRANTIS_SALT_GPG={{ user `apt_mirantis_gpg` }}",
         "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
         "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}",
         "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
diff --git a/ubuntu-14.04/scripts/docker.sh b/ubuntu-14.04/scripts/docker.sh
index bd79ed8..82b9d59 100644
--- a/ubuntu-14.04/scripts/docker.sh
+++ b/ubuntu-14.04/scripts/docker.sh
@@ -5,8 +5,8 @@
 
 # Add apt repository
 echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list
-echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list
-curl -sf http://apt.mirantis.com/public.gpg | apt-key add -
+echo "deb [arch=amd64] http://mirror.mirantis.com/nightly/extra/trusty trusty main" > /etc/apt/sources.list.d/mcp_extra.list
+curl -sf http://mirror.mirantis.com/nightly/extra/trusty/archive-extra.key | apt-key add -
 
 apt-get clean
 apt-get update
diff --git a/ubuntu-16.04/scripts/docker.sh b/ubuntu-16.04/scripts/docker.sh
index 3b22e5c..d5628ab 100644
--- a/ubuntu-16.04/scripts/docker.sh
+++ b/ubuntu-16.04/scripts/docker.sh
@@ -4,9 +4,9 @@
 apt-get -y install curl
 
 # Add apt repository
-echo "deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list
-echo "deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list
-curl -sf http://apt.mirantis.com/public.gpg | apt-key add -
+echo "deb [arch=amd64] http://mirror.mirantis.com/nightly/docker/xenial/ xenial main" > /etc/apt/sources.list.d/mcp_salt.list
+echo "deb [arch=amd64] http://mirror.mirantis.com/nightly/extra/xenial/ xenial main" > /etc/apt/sources.list.d/mcp_extra.list
+curl -sf http://mirror.mirantis.com/nightly/extra/xenial/archive-extra.key | apt-key add -
 
 apt-get clean
 apt-get update