Skip to content

Instantly share code, notes, and snippets.

@sidneiweber
sidneiweber / deploy_main.yml
Last active December 27, 2019 21:46
deploy
# cat roles/deploy/tasks/main.yml
- name: Copy Script config
win_copy:
src: script.ps1
dest: C:\Windows\Temp\script.ps1
- name: Execute script
win_shell: C:\Windows\Temp\script.ps1
- name: ensure IIS and ASP.NET are installed
# cat roles/deploy/files/script.ps1
# Install Chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Globally Auto confirm every action
choco feature enable -n allowGalobalConfirmation
# Install JDK 8 and git
choco install jdk8
choco install git
# cat roles/build-ami/tasks/main.yml
- name: Create AMI
ec2_ami:
region: "{{ target_aws_region }}"
instance_id: "{{ item.id }}"
name: "windows-personalizado"
wait: yes
state: present
with_items: "{{ ec2_result.tagged_instances }}"
register: ami
# cat roles/terminate/tasks/main.yml
- name: ensure instances are not running
ec2:
region: "{{ target_aws_region }}"
image: "{{ win_ami_id }}"
instance_type: "{{ instance_type }}"
group_id: "{{ sg_out.group_id }}"
key_name: "{{ keypair }}"
wait: yes
wait_timeout: 500
# cat deploy.yml
- hosts: localhost
gather_facts: no
roles:
- role: launch
name: win
- hosts: win
roles:
- deploy
{"version":1,"resource":"file:///home/sidnei/teste.go","entries":[{"id":"GNpS.go","source":"textFileCreate.source","timestamp":1653672755513},{"id":"JKJk.go","timestamp":1653672802221},{"id":"D6dO.go","timestamp":1653672833609},{"id":"cfnA.go","timestamp":1653672863453}]}