-
Notifications
You must be signed in to change notification settings - Fork 166
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
Showing
9 changed files
with
143 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
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 @@ | ||
[profile worker] |
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,10 @@ | ||
--- | ||
|
||
argument_specs: | ||
main: | ||
short_description: Set up specific to hosts that build releases. | ||
options: | ||
release_home_dir: | ||
description: The user's HOME directory. | ||
required: yes | ||
type: str |
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,6 @@ | ||
--- | ||
|
||
dependencies: | ||
- role: read-secrets | ||
- role: user-create | ||
when: not os|startswith("win") |
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,15 @@ | ||
--- | ||
|
||
# Set up release hosts to be able to upload to clouflare. | ||
# Requires access to the secrets repository. User should have already | ||
# been prompted for GPG credentials during the inventory load. | ||
|
||
- name: run os-specific deploy | ||
include: "{{ deploy_include }}" | ||
loop_control: | ||
loop_var: deploy_include | ||
with_first_found: | ||
- files: | ||
- "{{ role_path }}/tasks/partials/{{ os|stripversion }}.yml" | ||
- "{{ role_path }}/tasks/partials/default.yml" | ||
skip: true |
46 changes: 46 additions & 0 deletions
46
ansible/roles/cloudflare-deploy/tasks/partials/default.yml
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,46 @@ | ||
--- | ||
|
||
- name: create .aws directory | ||
ansible.builtin.file: | ||
dest: "{{ release_home_dir }}/.aws" | ||
owner: "{{ server_user }}" | ||
group: "{{ server_user }}" | ||
state: directory | ||
|
||
- name: copy credentials to deploy release artifacts | ||
ansible.builtin.copy: | ||
content: "{{ secrets.worker_credentials }}" | ||
dest: "{{ release_home_dir }}/.aws/credentials" | ||
owner: "{{ server_user }}" | ||
group: "{{ server_user }}" | ||
|
||
- name: write worker_config | ||
ansible.builtin.copy: | ||
dest: "{{ release_home_dir }}/.aws/config" | ||
src: "{{ role_path }}/files/worker_config" | ||
owner: "{{ server_user }}" | ||
group: "{{ server_user }}" | ||
when: not os|startswith("win") | ||
|
||
|
||
# https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html | ||
- name: Download awscliv2 installer | ||
unarchive: | ||
src: "https://awscli.amazonaws.com/awscli-exe-linux-{{ ansible_architecture }}.zip" | ||
dest: "/tmp" | ||
remote_src: true | ||
creates: '/tmp/aws' | ||
mode: 0755 | ||
|
||
- name: Run awscliv2 installer | ||
command: | ||
args: | ||
cmd: "/tmp/aws/install" | ||
creates: /usr/local/bin/aws | ||
become: true | ||
register: aws_install | ||
|
||
- name: "Show awscliv2 installer output" | ||
debug: | ||
var: aws_install | ||
verbosity: 2 |
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,28 @@ | ||
--- | ||
|
||
- name: create .aws directory | ||
ansible.builtin.file: | ||
dest: "{{ release_home_dir }}/.aws" | ||
owner: "{{ server_user }}" | ||
group: "{{ server_user }}" | ||
state: directory | ||
|
||
- name: copy credentials to deploy release artifacts | ||
ansible.builtin.copy: | ||
content: "{{ secrets.worker_credentials }}" | ||
dest: "{{ release_home_dir }}/.aws/credentials" | ||
owner: "{{ server_user }}" | ||
group: "{{ server_user }}" | ||
|
||
- name: write worker_config | ||
ansible.builtin.copy: | ||
dest: "{{ release_home_dir }}/.aws/config" | ||
src: "{{ role_path }}/files/worker_config" | ||
owner: "{{ server_user }}" | ||
group: "{{ server_user }}" | ||
when: not os|startswith("win") | ||
|
||
|
||
- name: install awscli | ||
community.general.homebrew: name="awscli" state=present | ||
become_user: "{{ ansible_user }}" |
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,19 @@ | ||
--- | ||
|
||
- name: create .aws directory | ||
win_file: | ||
path: '{{ansible_facts["env"]["USERPROFILE"]}}\.aws' | ||
state: directory | ||
|
||
- name: copy credentials to deploy release artifacts | ||
win_copy: | ||
content: "{{ secrets.worker_credentials }}" | ||
dest: '{{ansible_facts["env"]["USERPROFILE"]}}\.aws\credentials' | ||
|
||
- name: write worker_config | ||
win_copy: | ||
dest: '{{ansible_facts["env"]["USERPROFILE"]}}\.aws\config' | ||
src: "{{ role_path }}/files/worker_config" | ||
|
||
- name: install AWS CLI | ||
win_chocolatey: name=awscli |
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