Skip to content

Commit

Permalink
New appdeploy (#3766)
Browse files Browse the repository at this point in the history
* add tower deploy vm to inventory
* create a towerdeploy role.
this role installs capistrano which will be used to deploy applications

Co-authored-by: Alicia Cozine<[email protected]>
Co-authored-by: Bess Sadler <[email protected]>
Co-authored-by: James R. Griffin III <[email protected]>
Co-authored-by: Max Kadel <[email protected]>
Co-authored-by: Robert-Anthony Lee-Faison <[email protected]>
* enables us to test role
* alicia proof alphabetical
* remove redundant ruby_s role which is on the meta/main
* add capistrano composer
  • Loading branch information
kayiwa authored Apr 11, 2023
1 parent 3275b7b commit 55d3d78
Show file tree
Hide file tree
Showing 15 changed files with 289 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/molecule_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
- subversion
- svn
- timezone
- towerdeploy
- tomcat8
- video_reserves
- vips
Expand Down
5 changes: 5 additions & 0 deletions group_vars/towerdeploy/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
install_ruby_from_source: true
ruby_version_override: "ruby-3.2.1"
bundler_version: "2.4.10"
deploy_id_rsa_private_key: "{{ vault_deployment_private_key }}"
92 changes: 92 additions & 0 deletions group_vars/towerdeploy/vault.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
$ANSIBLE_VAULT;1.1;AES256
65633863363138353864343731383237356163353035323662343566356434356232663365656531
6265383663343562643261326661393565376336383935360a313933653362356465346639663637
38316631396639373430613839333830346435356532633461323162653266653930303238623432
3439353161363230320a633466363766323432653864653538633035356439616437636462646635
36626261333338353865613866333461353064636137303935366161333238326238616661326464
34353465346365336265656161326335666333353765376162373536393431303365343631663331
30386530393465656565363462643938616136393865343666363966613230336163306661396238
62393761626530313832373062336265393561333132383932383134323238316136346164326463
30323430316336313861323036303734646334363764326562373535356535333865393363316538
39386564303139313935356332653361656236323736366135633831623565313137613630633263
30306333323139383237303735643035663430343566643161306535333530343430663735366630
39356237306330613032303132386631383065363366313738356535376135393937666163656463
38643836323430373534383238363266353466383264636532313762653439633631613466616562
35333136623539643531323337303131636663303339653535323137643039373231633161356265
32393236366235363239363830353530613833653534343264333135343930653965373833396538
36653134653164336266313439616336383461663938323931313335366366323137306639656635
62323137666133323638613232333966396361323566336635383336306237326362666638376439
63356535643437373930353031623066373161316663636532393133366363653530386565663364
36643530323762333662663663366438326535353034326234613132326565643333623464323930
64323461383561396363616536393630636436323331376633656337316364666538653662633139
35363161323735346535376635613263343466323532313566363835323934333635653435383439
34396466373162333630366663323432613832636666626566316439363638316432356362396562
31386432653962373134663164373863316234656565646333346639356238316637373131636262
65623662333232316362616336633931626630386637323535393333333861356539336262353034
31373562376364636539623861383464663036316433653530623633373138393839623939333037
33613865623939636239656135636135636136333033323033353838393337353966393936316631
34346465616164663263303566623462393864386538373665656633613731376438663066343962
66363637636437653031656666343962643363353530396530326164633765303565363139643039
64343966353235643235663135623564383166396439343437333738343139306664633265316164
64326266613834363030346438646432353565313538346338346532333937393934356538353862
32343730666335303237333333376166316531326364363333383637623032363530313461346664
62636435623138313735393731323334333534646335626432663036383962653535306366616132
62383233626634666235343533386462333935363766636235313834326361666230643030623561
31303032626233386361373435386464363036323730663361623932616162386566366161396266
66363766326630623661653665653932633036656639393034326163303737646664313138626164
64363939656235343337333961316130343166333030623435666361353961353531323831666164
35326137326232393136363638643064363430333332313536366166613664346366383565653635
63346334616663306238396435353464616339623364313865326133666233383334323336363662
63366533643432303861336234663564343835353461386239656433313065346363373865363834
64613538313162653836346238353737393136363063616462663064613734316637653565623461
62373565356231656239643839653534343433323931653339306465326564336634663933623162
61326433316133663133373565626533613536623662393832666265363864643436613861326237
61373436616461383639386461643965643862346430313064313533396533383032356265616562
64613535653338383263666266353639363862333830353030623264396664663865386566313739
66636264636538346136323230623836326637306465666530353338366433326530323333623362
62373532653565316164643139363839666633353133653266303738343733353536313364333538
36383933626464303836626530343630333138636364326334376438663137356165383139663966
66643138366431316462306536303061373361303863313634363063353462643135626239623862
63663132613638613835346264383166353339616536653639626463366165373063623266666134
30623362346435643832646233666262376234656430656431363734386265313130356332353537
62613037346364373639353732643731666234663363393230663663343637393737633261346361
31333630333734616636303536333733303134363636643465303833363537616134303163663635
65646264346338393232613762633466343032333131356163316535313361356138353830313864
35613734386137356432346366643435363965386166323430396238323862616432623065643132
30313433366637323836303430653630316438343731383064306364303230323530333461623261
66313233363063346334346563326230613062623331383462336138336264313432353266623665
33623431303030343234393038643031633462393831646135386635623531353265376432376134
38666232373532396462303432336264316663393165653433613038643664323365626138333934
63306134363132376430336131343761636534353937333933656535393131396633316331303833
37666633393333336139636435393430333061663739386637643463613139653634346433316633
32303833316463306462623264326563326234316633323238656230373461343232353631623037
35656565366237663564313034373166616636663163383464383263623461363432646162613636
63626564316333313634636561663534333036313761303533353337663366373765666662393562
30626431653530623036343931613532353436653863623631646136343832383237653034396630
38383235333435333531626331343139373435393663316430376565623962383235623239353233
37353862336666386565643463336265633030323164393133326533366631653932666231643765
38386364333637376239306162323037316131653830303837383432363833383533633035383237
64636138306363366162376262613734323163623565323261656634613163663464376165316561
39303430663861306138663465633636373365613337663062343632353465386235323034396362
61306433623230613564363137363131396338653732616665363465396432653237633832376564
31636634333036376265303337663635306437313136343165353435346366326663623637393230
61613765366439613961346130613639326665336162386661316162363432373262333032336632
65323932653337656161346433336561633962393665356538373839363935623264323934346366
61366333393632333430323337623335313833393565626164643562623666376261633435326666
32373736633030313561663132316232623238303230646238376134303731346465353062363765
39616264386133306565633630306563393966343339356534343739653332653663343566363263
63303935366233656136336638643462613665646137366235366631336462396565336336373665
61363934653037383863613731323234636164353562396162313761623730383266336132636532
38633831613531393166393134626633323537313139623139653830653839363233636665386536
31626433396138313733626466633631343764393965666135313930316236343235633862656236
61323632396261326438663831323763663366356330663161636432333734633837633664613836
61633162343035356532396630646539636636303433343834376531613939383165313730643737
33393666356265633462393433653561646537656131323263666665633032333437643030313064
61666363383366386336323464326262646637646333646664303338613666373338613534346235
64653132616261313935306432353865666265623964623932613262326431663164326333623537
63363663306438646266626564663261646365343337613638326535613537323432613264353063
65663138356166383432623631306639633461303761336131383832303237346434633465663732
30386165663637666132666339306430306465313534663737333132616462313661613463663763
38613036366438613166303433656339306239303633366362363162353139323064643637346461
63343137376664396263383064356238643837323738643237323838373061656234636631333162
356363393234653230653338613031343937
21 changes: 21 additions & 0 deletions playbooks/towerdeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# to run in production, pass '-e runtime_env=production'
- name: deploy an application deployment environment
hosts: towerdeploy
remote_user: pulsys
become: true
vars_files:
- ../group_vars/towerdeploy/production.yml
- ../group_vars/towerdeploy/vault.yml

roles:
- role: roles/deploy_user
- role: roles/towerdeploy

post_tasks:
- name: tell everyone on slack you ran an ansible playbook
community.general.slack:
token: "{{ vault_pul_slack_token }}"
msg: "Ansible ran `{{ ansible_play_name }}` on {{ inventory_hostname }}"
channel: #server-alerts
when: not ansible_check_mode
14 changes: 14 additions & 0 deletions roles/towerdeploy/.yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
# NOTE(retr0h): Templates no longer fail this lint rule.
# Uncomment if running old Molecule templates.
# truthy: disable
35 changes: 35 additions & 0 deletions roles/towerdeploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Role Name
=========

Installs an execution environment for [Ansible](https://ansible-tower.princeton.edu)

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


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


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


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).
3 changes: 3 additions & 0 deletions roles/towerdeploy/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# defaults file for towerdeploy
cap_version: "3.17.2"
2 changes: 2 additions & 0 deletions roles/towerdeploy/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for towerdeploy
17 changes: 17 additions & 0 deletions roles/towerdeploy/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
galaxy_info:
role_name: towerdeploy
company: Princeton University Library
description: deploy from ansible tower
author: pulibrary

license: MIT

min_ansible_version: 2.9

platforms:
- name: Ubuntu
versions:
- jammy
dependencies:
- role: ruby_s
15 changes: 15 additions & 0 deletions roles/towerdeploy/molecule/default/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
***********************************
Delegated driver installation guide
***********************************

Requirements
============

This driver is delegated to the developer. Up to the developer to implement
requirements.

Install
=======

This driver is delegated to the developer. Up to the developer to implement
requirements.
15 changes: 15 additions & 0 deletions roles/towerdeploy/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Converge
hosts: all
vars:
- running_on_server: false
become: true
pre_tasks:
- name: update cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 600
tasks:
- name: "Include example"
ansible.builtin.include_role:
name: towerdeploy
22 changes: 22 additions & 0 deletions roles/towerdeploy/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
scenario:
name: default
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
platforms:
- name: instance
image: "quay.io/pulibrary/jammy-ansible:latest"
command: ""
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
log: true
verifier:
name: ansible
16 changes: 16 additions & 0 deletions roles/towerdeploy/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Verify
hosts: all
gather_facts: false
vars:
- cap_version: "3.17.2"
tasks:
- name: check capistrano status
ansible.builtin.command: cap --version
changed_when: false
register: cap_status

- name: test for cap version
assert:
that:
- "'{{ cap_version }}' in cap_status.stdout"
29 changes: 29 additions & 0 deletions roles/towerdeploy/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# tasks file for towerdeploy

- name: towerdeploy | install capistrano
ansible.builtin.command: gem install capistrano --version "{{ cap_version }}"
register: gemoutput
changed_when: gemoutput.rc != 0
failed_when: gemoutput.rc !=0

- name: towerdeploy | install capistrano dependencies
ansible.builtin.command: gem install "{{ item }}" airbrussh
register: capgemoutput
changed_when: capgemoutput.rc != 0
failed_when: capgemoutput.rc !=0
loop:
- airbrussh
- capistrano-composer
- capistrano-passenger
- capistrano-rails
- capistrano-rails-console
- capistrano-yarn
- concurrent-ruby
- honeybadger
- i18n
- net-scp
- net-ssh
- rake
- sshkit
- whenever
2 changes: 2 additions & 0 deletions roles/towerdeploy/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for towerdeploy

0 comments on commit 55d3d78

Please sign in to comment.