Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
*/env
*.pem
*/open_three-tier-app.repo

.*.swp
9 changes: 9 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
extends: default
rules:
comments: disable
comments-indentation: disable
indentation:
indent-sequences: false
line-length:
max: 120
4 changes: 2 additions & 2 deletions ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ inventory = hosts
retry_files_enabled = false

[ssh_connection]
#ssh_args = -F ./ssh-bastion.cfg
ssh_args = -F ./ssh-laptop.cfg
ssh_args = -F ./ssh-bastion.cfg
#ssh_args = -F ./ssh-laptop.cfg
# Uncomment above to work from remote control node
46 changes: 23 additions & 23 deletions cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@
become: true
vars:
three_tier_packages:
- httpie
- python-pip
- haproxy
- tomcat
- postgresql-server
- httpie
- python-pip
- haproxy
- tomcat
- postgresql-server

tasks:

- name: reverse the enabling of sudo without tty for some ansible commands
replace:
path: /etc/sudoers
regexp: 'Defaults\s*!requiretty'
replace: '^Defaults requiretty'
backup: yes
- name: reverse the enabling of sudo without tty for some ansible commands
replace:
path: /etc/sudoers
regexp: 'Defaults\s*!requiretty'
replace: '^Defaults requiretty'
backup: true

- name: Remove the repo file
file:
state: absent
path: /etc/yum.repos.d/open_three-tier-app.repo
- name: Remove the repo file
file:
state: absent
path: /etc/yum.repos.d/open_three-tier-app.repo

- name: Remove base tools and three tier app packages
yum:
name: "{{ three_tier_packages }}"
state: absent
- name: Remove base tools and three tier app packages
yum:
name: "{{ three_tier_packages }}"
state: absent

- name: Remove index.html
file:
path: /tmp/index.html
state: absent
- name: Remove index.html
file:
path: /tmp/index.html
state: absent
...
10 changes: 3 additions & 7 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@
# Bare variables
# No use of handlers

- name: configuration
- name: Common configuration
hosts: all
gather_facts: false # remove later! speeds up testing
become: true
roles:
- common

tasks:
- name: enable repos
template:
src: ./open_three-tier-app.repo
dest: /etc/yum.repos.d/open_three-tier-app.repo
mode: 0644

- name: deploy haproxy
hosts: frontends
Expand Down
38 changes: 38 additions & 0 deletions roles/common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Role Name
=========

A brief description of the role goes here.

Requirements
------------

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.

Role Variables
--------------

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.

Dependencies
------------

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.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
roles:
- { role: username.rolename, x: 42 }

License
-------

BSD

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
2 changes: 2 additions & 0 deletions roles/common/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# defaults file for common
2 changes: 2 additions & 0 deletions roles/common/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for common
15 changes: 15 additions & 0 deletions roles/common/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
galaxy_info:
author: Johnathan Kupferer
description: Three tier app common
company: Red Hat
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 2.7
platforms:
- name: GenericLinux
versions:
- all

galaxy_tags: []

dependencies: []
2 changes: 2 additions & 0 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
- include_tasks: yum-repos.yml
6 changes: 6 additions & 0 deletions roles/common/tasks/yum-repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: enable repos
template:
src: open_three-tier-app.repo.j2
dest: /etc/yum.repos.d/open_three-tier-app.repo
mode: u=rw,go=r
32 changes: 32 additions & 0 deletions roles/common/templates/open_three-tier-app.repo.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[rhel-7-server-rpms]
name=Red Hat Enterprise Linux 7
baseurl=http://admin.na.shared.opentlc.com/repos/ocp/3.6/rhel-7-server-rpms
enabled=1
gpgcheck=0

[rhel-7-server-rh-common-rpms]
name=Red Hat Enterprise Linux 7 Common
baseurl=http://admin.na.shared.opentlc.com/repos/ocp/3.6/rhel-7-server-rh-common-rpms
enabled=1
gpgcheck=0

[rhel-7-server-extras-rpms]
name=Red Hat Enterprise Linux 7 Extras
baseurl=http://admin.na.shared.opentlc.com/repos/ocp/3.6/rhel-7-server-extras-rpms
enabled=1
gpgcheck=0

[rhel-7-server-optional-rpms]
name=Red Hat Enterprise Linux 7 Optional
baseurl=http://admin.na.shared.opentlc.com/repos/ocp/3.6/rhel-7-server-optional-rpms
enabled=1
gpgcheck=0

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
2 changes: 2 additions & 0 deletions roles/common/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for common
6 changes: 3 additions & 3 deletions ssh-bastion.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Match User ec2-user
IdentityFile ./6400key.pem

Host *.internal
User ec2-user
StrictHostKeyChecking no
ControlMaster auto
ControlPath /tmp/%h-%r
ControlPersist 5m

Match User ec2-user
IdentityFile ~/.ssh/466ekey.pem