mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-11-01 20:10:15 +00:00
Chocolatey server role
This commit is contained in:
1 parent
265f582bdf
commit
3027c3dd76
6 files changed
+150
No files matched your search
@@ -0,0 +1,55 @@
|
||||
---
|
||||
- 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
|
||||
- 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
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: Chocolatey Disk
|
||||
tags: choco_disk
|
||||
block:
|
||||
- name: Initialise chocolatey disk
|
||||
win_initialize_disk:
|
||||
disk_number: 1
|
||||
|
||||
- name: Format/Partition disk
|
||||
win_partition:
|
||||
drive_letter: "{{ choco_drive_letter }}"
|
||||
disk_number: 1
|
||||
partition_size: -1
|
||||
state: present
|
||||
|
||||
- name: Create NTFS filesystem and label it
|
||||
win_format:
|
||||
drive_letter: "{{ choco_drive_letter }}"
|
||||
file_system: NTFS
|
||||
new_label: Chocolatey
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
- import_tasks: disk.yml
|
||||
#- import_tasks: setup.yml
|
||||
- import_tasks: chocolatey.yml
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Features
|
||||
tags: choco_features
|
||||
block:
|
||||
- name: Install IIS and management tools # can maybe be skipped (imported role already does this)
|
||||
win_feature:
|
||||
name:
|
||||
- Web-WebServer
|
||||
- Web-Scripting-Tools
|
||||
state: present
|
||||
include_management_tools: yes
|
||||
include_sub_features: yes
|
||||
register: feature_status
|
||||
|
||||
- name: Install .Net framework (4.5.2 minimum requirement for choco GUI)
|
||||
ansible.windows.win_optional_feature:
|
||||
name: NetFx4
|
||||
state: present
|
||||
register: opt_feature_status
|
||||
|
||||
- name: Rebooting Servers post feature installation
|
||||
win_reboot:
|
||||
reboot_timeout_sec: 1200
|
||||
when: feature_status.reboot_required == true or
|
||||
opt_feature_status.reboot_required == true
|
||||
Reference in new issue
Block a user