-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae5cbf9
commit c8a8312
Showing
11 changed files
with
267 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env -S ansible-playbook -i ${PWD}/ansible-inventories | ||
# code: language=ansible | ||
--- | ||
|
||
- name: script | ||
vars: | ||
ansible_connection: local | ||
hosts: windows | ||
connection: local | ||
tasks: | ||
|
||
- name: mkdir script | ||
delegate_to: localhost | ||
connection: local | ||
ansible.builtin.file: | ||
state: directory | ||
path: "{{ inventory_dir }}/../scoop/{{ inventory_hostname }}" | ||
|
||
- name: template script | ||
delegate_to: localhost | ||
connection: local | ||
ansible.builtin.template: | ||
src: "{{ playbook_dir }}/scoop.install.ps1.j2" | ||
dest: "{{ inventory_dir }}/../scoop/{{ inventory_hostname }}/scoop.install.ps1" | ||
register: package_install_template | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env -S ansible-playbook -k -i ${PWD}/ansible-inventories | ||
# code: language=ansible | ||
--- | ||
|
||
- name: install | ||
hosts: windows | ||
tasks: | ||
|
||
- name: install bucket | ||
loop: "{{ scoop.buckets | default([],true) }}" | ||
vars: | ||
combine: | ||
state: present | ||
args: "{{ item | combine(combine, recursive=True) }}" | ||
community.windows.win_scoop_bucket: "{{ args }}" | ||
register: bucket_install | ||
until: bucket_install is succeeded | ||
|
||
- name: install group config | ||
vars: | ||
group_names: "{{ scoop.groups | default([],true) }}" | ||
group_vars: "{{ scoop_groups | default({},true) | ||
| dict2items | ||
| selectattr('key','in',group_names) | ||
| selectattr('value.buckets','defined') | ||
| map(attribute='value.buckets') | ||
| flatten }}" | ||
combine: | ||
state: present | ||
args: "{{ item | combine(combine, recursive=True) }}" | ||
loop: "{{ group_vars }}" | ||
community.windows.win_scoop_bucket: "{{ args }}" | ||
register: bucket_install | ||
until: bucket_install is succeeded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env -S ansible-playbook -i ${PWD}/ansible-inventories | ||
# code: language=ansible | ||
--- | ||
|
||
- name: script | ||
vars: | ||
ansible_connection: local | ||
hosts: windows | ||
connection: local | ||
tasks: | ||
|
||
- name: mkdir script | ||
delegate_to: localhost | ||
connection: local | ||
ansible.builtin.file: | ||
state: directory | ||
path: "{{ inventory_dir }}/../scoop/{{ inventory_hostname }}" | ||
|
||
- name: template install buckets script | ||
delegate_to: localhost | ||
connection: local | ||
vars: | ||
group_names: "{{ scoop.groups | default([],true) }}" | ||
group_vars: "{{ scoop_groups | default({},true) | ||
| dict2items | ||
| selectattr('key','in',group_names) | ||
| selectattr('value.buckets','defined') | ||
| rejectattr('value.buckets','equalto',None) }}" | ||
group_buckets_all: | ||
- group: default | ||
buckets: "{{ scoop.buckets | default([],true) }}" | ||
- "{{ group_vars | ||
| community.general.json_query('[].{group:key,buckets:value.buckets}') }}" | ||
configs: "{{ group_buckets_all | flatten }}" | ||
buckets: "{{ item.buckets }}" | ||
loop: "{{ configs }}" | ||
ansible.builtin.template: | ||
src: "{{ playbook_dir }}/bucket.install.ps1.j2" | ||
dest: "{{ inventory_dir }}/../scoop/{{ inventory_hostname }}/{{ item.group }}.bucket.install.ps1" | ||
register: bucket_install_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$_script_dir = Split-Path -parent $MyInvocation.MyCommand.Definition | ||
|
||
{% for bucket in buckets %} | ||
scoop bucket add {{ bucket.name }} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env -S ansible-playbook -i ${PWD}/ansible-inventories | ||
# code: language=ansible | ||
--- | ||
|
||
- name: script | ||
vars: | ||
ansible_connection: local | ||
hosts: windows | ||
connection: local | ||
tasks: | ||
|
||
- name: mkdir script | ||
delegate_to: localhost | ||
connection: local | ||
ansible.builtin.file: | ||
state: directory | ||
path: "{{ inventory_dir }}/../scoop/{{ inventory_hostname }}" | ||
|
||
- name: template install configs script | ||
delegate_to: localhost | ||
connection: local | ||
vars: | ||
group_names: "{{ scoop.groups | default([],true) }}" | ||
group_vars: "{{ scoop_groups | default({},true) | ||
| dict2items | ||
| selectattr('key','in',group_names) | ||
| selectattr('value.configs','defined') | ||
| rejectattr('value.configs','equalto',None) }}" | ||
group_vars_all: | ||
- group: default | ||
configs: "{{ scoop.configs | default([],true) }}" | ||
- "{{ group_vars | ||
| community.general.json_query('[].{group:key,configs:value.configs}') }}" | ||
group_vars_flatten: "{{ group_vars_all | flatten }}" | ||
configs: "{{ item.configs }}" | ||
loop: "{{ group_vars_flatten }}" | ||
ansible.builtin.template: | ||
src: "{{ playbook_dir }}/config.set.ps1.j2" | ||
dest: "{{ inventory_dir }}/../scoop/{{ inventory_hostname }}/{{ item.group }}.config.set.ps1" | ||
register: config_set_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env -S ansible-playbook -k -i ${PWD}/ansible-inventories | ||
# code: language=ansible | ||
--- | ||
|
||
- name: set | ||
hosts: windows | ||
tasks: | ||
|
||
- name: set config | ||
loop: "{{ scoop.configs | default([],true) }}" | ||
vars: | ||
combine: | ||
state: present | ||
args: "{{ item | combine(combine, recursive=True) }}" | ||
ansible.windows.win_powershell: | ||
script: scoop config {{ args.name }} {{ args.value }} | ||
register: config_set | ||
until: config_set is succeeded | ||
|
||
- name: set group config | ||
vars: | ||
group_names: "{{ scoop.groups | default([],true) }}" | ||
group_vars: "{{ scoop_groups | default({},true) | ||
| dict2items | ||
| selectattr('key','in',group_names) | ||
| selectattr('value.configs','defined') | ||
| map(attribute='value.configs') | ||
| flatten }}" | ||
combine: | ||
state: present | ||
args: "{{ item | combine(combine, recursive=True) }}" | ||
loop: "{{ group_vars }}" | ||
ansible.windows.win_powershell: | ||
script: scoop config {{ args.name }} {{ args.value }} | ||
register: config_set | ||
until: config_set is succeeded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$_script_dir = Split-Path -parent $MyInvocation.MyCommand.Definition | ||
|
||
{% for config in configs %} | ||
scoop config {{ config.name }} {{ config.value }} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env -S ansible-playbook -k -i ${PWD}/ansible-inventories | ||
# code: language=ansible | ||
--- | ||
|
||
- name: install | ||
hosts: windows | ||
tasks: | ||
|
||
- name: install package | ||
loop: "{{ scoop.packages | default([],true) }}" | ||
vars: | ||
combine: | ||
state: present | ||
args: "{{ item | combine(combine, recursive=True) }}" | ||
community.windows.win_scoop: "{{ args }}" | ||
register: package_install | ||
until: package_install is succeeded | ||
|
||
- name: install group config | ||
vars: | ||
group_names: "{{ scoop.groups | default([],true) }}" | ||
group_vars: "{{ scoop_groups | default({},true) | ||
| dict2items | ||
| selectattr('key','in',group_names) | ||
| selectattr('value.packages','defined') | ||
| map(attribute='value.packages') | ||
| flatten }}" | ||
combine: | ||
state: present | ||
args: "{{ item | combine(combine, recursive=True) }}" | ||
loop: "{{ group_vars }}" | ||
community.windows.win_scoop: "{{ args }}" | ||
register: package_install | ||
until: package_install is succeeded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env -S ansible-playbook -i ${PWD}/ansible-inventories | ||
# code: language=ansible | ||
--- | ||
|
||
- name: script | ||
vars: | ||
ansible_connection: local | ||
hosts: windows | ||
connection: local | ||
tasks: | ||
|
||
- name: mkdir script | ||
delegate_to: localhost | ||
connection: local | ||
ansible.builtin.file: | ||
state: directory | ||
path: "{{ inventory_dir }}/../scoop/{{ inventory_hostname }}" | ||
|
||
- name: template install packages script | ||
delegate_to: localhost | ||
connection: local | ||
vars: | ||
group_names: "{{ scoop.groups | default([],true) }}" | ||
group_vars: "{{ scoop_groups | default({},true) | ||
| dict2items | ||
| selectattr('key','in',group_names) | ||
| selectattr('value.packages','defined') | ||
| rejectattr('value.packages','equalto',None) }}" | ||
group_packages_all: | ||
- group: default | ||
packages: "{{ scoop.packages | default([],true) }}" | ||
- "{{ group_vars | ||
| community.general.json_query('[].{group:key,packages:value.packages}') }}" | ||
configs: "{{ group_packages_all | flatten }}" | ||
packages: "{{ item.packages }}" | ||
loop: "{{ configs }}" | ||
ansible.builtin.template: | ||
src: "{{ playbook_dir }}/package.install.ps1.j2" | ||
dest: "{{ inventory_dir }}/../scoop/{{ inventory_hostname }}/{{ item.group }}.package.install.ps1" | ||
register: package_install_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
$_script_dir = Split-Path -parent $MyInvocation.MyCommand.Definition | ||
|
||
{% for package in packages %} | ||
scoop install {{ package.name }} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | ||
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression |