Skip to content

Commit 03e8acd

Browse files
committed
First commit - spin up code.
1 parent a53f165 commit 03e8acd

File tree

10 files changed

+191
-0
lines changed

10 files changed

+191
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.retry

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Role Name
2+
=========
3+
4+
A brief description of the role goes here.
5+
6+
Requirements
7+
------------
8+
9+
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
10+
11+
Role Variables
12+
--------------
13+
14+
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
15+
16+
Dependencies
17+
------------
18+
19+
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
20+
21+
Example Playbook
22+
----------------
23+
24+
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
25+
26+
- hosts: servers
27+
roles:
28+
- { role: username.rolename, x: 42 }
29+
30+
License
31+
-------
32+
33+
BSD
34+
35+
Author Information
36+
------------------
37+
38+
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

defaults/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# defaults file for codedeploy

files/codedeploy-uninstall.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
CODEDEPLOY_BIN="/opt/codedeploy-agent/bin/codedeploy-agent"
3+
4+
if [ -f "$CODEDEPLOY_BIN" ]; then
5+
echo "$CODEDEPLOY_BIN exists."
6+
$CODEDEPLOY_BIN stop
7+
sudo yum erase codedeploy-agent -y
8+
fi

handlers/main.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# handlers file for codedeploy
3+
- name: service | codedeploy-agent | started
4+
service:
5+
name: codedeploy-agent
6+
state: started
7+
8+
- name: service | codedeploy-agent | stopped
9+
service:
10+
name: codedeploy-agent
11+
state: stopped
12+
13+
- name: service | codedeploy-agent | restarted
14+
service:
15+
name: codedeploy-agent
16+
state: restarted
17+
18+
- name: service | codedeploy-agent | reloaded
19+
service:
20+
name: codedeploy-agent
21+
state: reloaded

meta/main.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
galaxy_info:
2+
author: alexmbarbosa
3+
description: codedeploy-agent for amazon linux 2
4+
company: Zoox
5+
6+
# If the issue tracker for your role is not on github, uncomment the
7+
# next line and provide a value
8+
# issue_tracker_url: http://example.com/issue/tracker
9+
10+
# Choose a valid license ID from https://spdx.org - some suggested licenses:
11+
# - BSD-3-Clause (default)
12+
# - MIT
13+
# - GPL-2.0-or-later
14+
# - GPL-3.0-only
15+
# - Apache-2.0
16+
# - CC-BY-4.0
17+
license: license (GPL-2.0-or-later, MIT, etc)
18+
19+
min_ansible_version: 2.9
20+
21+
# If this a Container Enabled role, provide the minimum Ansible Container version.
22+
# min_ansible_container_version:
23+
24+
#
25+
# Provide a list of supported platforms, and for each platform a list of versions.
26+
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
27+
# To view available platforms and versions (or releases), visit:
28+
# https://galaxy.ansible.com/api/v1/platforms/
29+
#
30+
# platforms:
31+
# - name: Fedora
32+
# versions:
33+
# - all
34+
# - 25
35+
# - name: SomePlatform
36+
# versions:
37+
# - all
38+
# - 1.0
39+
# - 7
40+
# - 99.99
41+
42+
galaxy_tags: []
43+
# List tags for your role here, one per line. A tag is a keyword that describes
44+
# and categorizes the role. Users find roles by searching for tags. Be sure to
45+
# remove the '[]' above, if you add tags to this list.
46+
#
47+
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
48+
# Maximum 20 tags per role.
49+
50+
dependencies: []
51+
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
52+
# if you add dependencies to this list.
53+

tasks/main.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
# tasks file for codedeploy
3+
#
4+
# -- Update SO
5+
- name: upgrade all packages
6+
yum:
7+
name: '*'
8+
state: latest
9+
tags: [ yum_update_all ]
10+
11+
#-- Set Local Timezone
12+
- name: set timezone to Brazil
13+
timezone:
14+
name: America/Sao_Paulo
15+
tags: [ set_timezone ]
16+
17+
#-- Copies files to remote locations
18+
- copy:
19+
src: codedeploy-uninstall.sh
20+
dest: /tmp/codedeploy-uninstall.sh
21+
owner: root
22+
group: root
23+
mode: 0755
24+
tags: [ copy_uninstall_script ]
25+
26+
#-- Execute Uninstall current codedeploy script
27+
- name: execute uninstall script
28+
command: bash /tmp/codedeploy-uninstall.sh
29+
tags: [ execute_uninstall_script ]
30+
31+
#-- PreReqs Installation
32+
- name: Install prereqs for codedeploy-agent
33+
yum:
34+
name: "{{ packages }}"
35+
tags: [ install_prereqs ]
36+
37+
#-- Getting codedeploy package
38+
- name: Download install script
39+
get_url:
40+
url: 'https://{{ bucket_name }}.s3.{{ region_identifier }}.amazonaws.com/latest/install'
41+
dest: /tmp/install
42+
mode: '0755'
43+
tags: [ download_install_script ]
44+
45+
#-- Execute codeploy Installation script
46+
- name: execute install script
47+
command: /tmp/install auto
48+
tags: [ execute_install_script ]
49+
50+
#-- start codedeploy daemon
51+
- name: Start codedeploy-agent
52+
ansible.builtin.service:
53+
name: codedeploy-agent
54+
state: started
55+
tags: [ start_codedeploy_agent ]

tests/inventory

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
localhost
2+

tests/test.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- hosts: localhost
3+
remote_user: root
4+
roles:
5+
- codedeploy

vars/main.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
# vars file for codedeploy (https://docs.aws.amazon.com/pt_br/codedeploy/latest/userguide/resource-kit.html#resource-kit-bucket-names)
3+
4+
packages: [ ruby, wget, telnet ]
5+
bucket_name: "aws-codedeploy-us-east-1"
6+
region_identifier: "us-east-1"

0 commit comments

Comments
 (0)