Is there a way to set cookie values for files downloaded by HTTP on file.managed or archive.extracted. Something along the lines of
my-archive:
archive.extracted:
- name: /opt/
- archive_format: tar
- tar_options: z
- source: http://myserver/my-archive.tar.gz
- source_cookies:
- cookie1: value1
- cookie2: value2
My concrete use case is downloading jdk from oracle which requires a cookie accepting the license to be downloaded?
Is there anyway to achieve that?
That would be an awesome option to have, but it's not available yet. I've seen this done, though. It's kind of hackish, but should work.
install-java:
cmd.run:
- name: |
cd /tmp
mkdir -p /usr/lib/jvm
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u40-b26/server-jre-8u40-linux-x64.tar.gz
tar xzf server-jre-8u40-linux-x64.tar.gz -C /usr/lib/jvm
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_40/bin/java" 1
update-alternatives --set java /usr/lib/jvm/jdk1.8.0_40/bin/java
- cwd: /tmp
- shell: /bin/bash
- timeout: 300
- reload_modules: true
- unless: test -x /usr/lib/jvm/jdk1.8.0_40