Commit c454260c authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

packer: upload is done at the end of build-vm-bootstrap.yml

It was always done like this but has been removed in a previous cleanup (c7183d54). No need anymore for the upload.yml playbook.
parent d4039e72
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
- { name: "vm-bootstrap", size: "50", script: "scripts/vm-bootstrap.sh"} - { name: "vm-bootstrap", size: "50", script: "scripts/vm-bootstrap.sh"}
- { name: "vm-bootstrap", size: "25", script: "scripts/vm-bootstrap.sh"} - { name: "vm-bootstrap", size: "25", script: "scripts/vm-bootstrap.sh"}
#### Genetation of images are over. #### Generation of images are over.
#### Start compress everything #### Start compress everything
...@@ -173,3 +173,42 @@ ...@@ -173,3 +173,42 @@
- { name: "vm-bootstrap", size: "50", distro: "ubuntu-20.04-server"} - { name: "vm-bootstrap", size: "50", distro: "ubuntu-20.04-server"}
- { name: "vm-bootstrap", size: "25", distro: "ubuntu-20.04-server"} - { name: "vm-bootstrap", size: "25", distro: "ubuntu-20.04-server"}
#### End of build SHA512SUM.txt and MD5SUM.txt
#### Start uploading to shacache
- stat: path=/etc/opt/shacache/shacache.cfg
register: shacache_config
- name: Upload a list of images to shacache, there is no verification for now
shell: |
FILE=output-{{ item.distro }}-{{ item.size }}G-{{ item.name }}/packer-{{ item.distro }}-{{ item.size }}G-{{ item.name }}.gz
networkcache-upload --prefix-key packerimage- --url $FILE --file $FILE /etc/opt/shacache/shacache.cfg
SHA512SUM=$(cat SHA512SUM.txt | grep packer-{{ item.distro }}-{{ item.size }}G-{{ item.name }}.gz | cut -d ' ' -f1)
BASE_URL=$(cat /etc/opt/shacache/shacache.cfg | grep 'download-cache-url' | cut -d ' ' -f3)
MD5SUM=$(cat MD5SUM.txt | grep packer-{{ item.distro }}-{{ item.size }}G-{{ item.name }}.gz | cut -d ' ' -f1)
echo "packer-{{ item.distro }}-{{ item.size }}G-{{ item.name }}.gz $BASE_URL/$SHA512SUM $MD5SUM" >> URL.txt
with_items:
- { name: "vm-bootstrap", size: "200", distro: "debian9"}
- { name: "vm-bootstrap", size: "50", distro: "debian9"}
- { name: "vm-bootstrap", size: "25", distro: "debian9"}
- { name: "vm-bootstrap", size: "200", distro: "debian10"}
- { name: "vm-bootstrap", size: "50", distro: "debian10"}
- { name: "vm-bootstrap", size: "25", distro: "debian10"}
- { name: "vm-bootstrap", size: "200", distro: "debian11"}
- { name: "vm-bootstrap", size: "50", distro: "debian11"}
- { name: "vm-bootstrap", size: "25", distro: "debian11"}
- { name: "vm-bootstrap", size: "200", distro: "centos7"}
- { name: "vm-bootstrap", size: "50", distro: "centos7"}
- { name: "vm-bootstrap", size: "25", distro: "centos7"}
- { name: "vm-bootstrap", size: "200", distro: "centos8"}
- { name: "vm-bootstrap", size: "50", distro: "centos8"}
- { name: "vm-bootstrap", size: "25", distro: "centos8"}
- { name: "vm-bootstrap", size: "200", distro: "ubuntu-18.04-server"}
- { name: "vm-bootstrap", size: "50", distro: "ubuntu-18.04-server"}
- { name: "vm-bootstrap", size: "25", distro: "ubuntu-18.04-server"}
- { name: "vm-bootstrap", size: "200", distro: "ubuntu-20.04-server"}
- { name: "vm-bootstrap", size: "50", distro: "ubuntu-20.04-server"}
- { name: "vm-bootstrap", size: "25", distro: "ubuntu-20.04-server"}
when: shacache_config.stat.exists == True and upload_shacache == "yes"
#### End of uploading to shacache
- name: Upload a list of images to shacache, be sure you know what you are doing.
hosts: 127.0.0.1
connection: local
tasks:
- name: Upload a list of images to shacache, there is no verification for now
shell: networkcache-upload --prefix-key packerimage- --url {{ item }} --file {{ item }} shacache/shacache.cfg
with_items:
- output-debian8/packer-debian8.gz
- output-debian7/packer-debian7.gz
- output-ubuntu-14-04-server/packer-ubuntu-14-04-server.gz
- output-ubuntu-15-04-server/packer-ubuntu-15-04-server.gz
- output-centos72/packer-centos72.gz
- output-centos67/packer-centos67.gz
- output-debian8-testing-version/packer-debian8-testing-version.gz
- output-debian7-testing-version/packer-debian7-testing-version.gz
- output-ubuntu-15-04-server-testing-version/packer-ubuntu-15-04-server-testing-version.gz
- output-ubuntu-14-04-server-testing-version/packer-ubuntu-14-04-server-testing-version.gz
- output-centos67-testing-version/packer-centos67-testing-version.gz
- output-centos72-testing-version/packer-centos72-testing-version.gz
- output-debian8-webrunner/packer-debian8-webrunner.gz
- output-debian8-erp5-standalone/packer-debian8-erp5-standalone.gz
- output-debian8-wendelin/packer-debian8-wendelin.gz
- output-debian8-vm-bootstrap/packer-debian8-vm-bootstrap.gz
- output-debian7-vm-bootstrap/packer-debian7-vm-bootstrap.gz
- output-ubuntu-14-04-server-vm-bootstrap/packer-ubuntu-14-04-server-vm-bootstrap.gz
- output-ubuntu-15-04-server-vm-bootstrap/packer-ubuntu-15-04-server-vm-bootstrap.gz
- output-centos68-vm-bootstrap/packer-centos68-vm-bootstrap.gz
- output-centos72-vm-bootstrap/packer-centos72-vm-bootstrap.gz
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment