Files
windows-ansible/ansible/roles/win_chocolatey/tasks/chocolatey.yml
T

72 lines
2.4 KiB
YAML

---
- name: Chocolatey Server
tags: choco_server
block:
- name: Set up chocolatey server
import_role:
name: jborean93.win_chocolatey_server
- name: Chocolatey Packages
tags:
- all_packages
block:
- name: Community Pacakges
tags: community_packages
block:
- name: Download base software packages to Chocolatey server.
win_get_url:
url: "https://community.chocolatey.org/api/v2/package/{{ package.name }}/{{ package.version }}"
dest: "{{ choco_package_path }}\\{{ package.name }}.{{ package.version }}.nupkg"
loop: "{{ community_packages }}"
loop_control:
loop_var: package
- name: Custom Packages
tags:
- custom_packages
block:
- name: Get list of local packages
vars:
ansible_connection: local
find:
paths: "{{ local_package_path }}"
file_type: file
patterns: "*.nupkg"
delegate_to: localhost
register: local_packages
- name: Copy custom packaged software to Chocolatey server.
win_copy:
src: "{{ package.path }}"
dest: "{{ choco_package_path }}\\"
#\\{{ package.path | basename | split('.') | first }}\\"
loop: "{{ local_packages.files }}"
loop_control:
loop_var: package
# taken from jborean93.win_chocolatey_server handler and modified with longer timeout (Create handler???)
- name: open package page to get Chocolatey server to load nuget packages
win_uri:
url: http://localhost:{{ opt_chocolatey_server_http_port }}/chocolatey/Packages
user: '{{ pri_chocolatey_server_username|default(omit) }}'
password: '{{ pri_chocolatey_server_password|default(omit) }}'
url_timeout: 600
tags: refresh_packages
- name: package installs
tags: install_packages
# possible reboot need to refresh path (check choco path to test for reboot???)
block:
- name: Add new internal Choco source (client machines)
win_chocolatey_source:
name: EPCC
state: present
source: 'http://localhost/chocolatey'
- name: Install Chocolatey GUI (client machines)
win_chocolatey:
name: ChocolateyGUI
state: present
package_params: "'/Global'"