Skip to content

Commit

Permalink
nodejs role needs common
Browse files Browse the repository at this point in the history
  • Loading branch information
kayiwa committed Nov 3, 2024
1 parent 61fa920 commit 7a433de
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 32 deletions.
2 changes: 2 additions & 0 deletions roles/nodejs/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ galaxy_info:
- name: Ubuntu
versions:
- bionic
dependencies:
- role: common
31 changes: 16 additions & 15 deletions roles/passenger/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
---
# Variable setup.
- name: Phusion | Include OS-specific variables.
include_vars: "main.yml"
ansible.builtin.include_vars: "main.yml"

- name: Phusion | Define nginx_user.
ansible.builtin.set_fact:
nginx_user: "{{ __nginx_user }}"
when: nginx_user is not defined

# Passenger repository setup.
- name: Phusion | Add Passenger apt key.
ansible.builtin.apt_key:
keyserver: keyserver.ubuntu.com
id: 561F9B9CAC40B2F7
state: present
# passenger keys
- name: Phusion | Add Phusion Passenger GPG key
ansible.builtin.shell:
cmd: curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt | gpg --dearmor | tee /etc/apt/trusted.gpg.d/phusion.gpg >/dev/null
changed_when: false

- name: Phusion | Add Phusion apt repo.
ansible.builtin.apt_repository:
repo: 'deb https://oss-binaries.phusionpassenger.com/apt/passenger {{ ansible_distribution_release }} main'
state: present
filename: passenger
# Passenger repository setup.
- name: Phusion | Add Phusion Passenger APT repository
ansible.builtin.shell:
cmd: echo deb https://oss-binaries.phusionpassenger.com/apt/passenger {{ ansible_distribution_release }} main > /etc/apt/sources.list.d/passenger.list
changed_when: false

- name: Phusion | Install Nginx and Passenger.
ansible.builtin.apt:
name: "{{ nginx_passenger_packages }}"
update_cache: true
state: present

# Nginx and passenger configuration.
- name: Phusion | Copy Nginx configuration into place.
ansible.builtin.template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
mode: 0644
mode: "0644"
tags: passenger_config
notify: 'passenger : restart nginx'

Expand All @@ -49,7 +48,7 @@
ansible.builtin.template:
src: passenger.j2
dest: /etc/nginx/sites-available/passenger
mode: 0644
mode: "0644"
notify: restart nginx

- name: Phusion | Ensure passenger virtual host is enabled.
Expand All @@ -62,7 +61,7 @@
ansible.builtin.file:
path: /etc/nginx/sites-enabled/default
state: absent
mode: 0644
mode: "0644"
when: nginx_remove_default_vhost
notify:
- restart nginx
Expand All @@ -71,12 +70,14 @@
ansible.builtin.file:
path: /etc/systemd/system/nginx.service.d
state: directory
mode: "0644"
tags: nginx

- name: Phusion | Restart nginx on crash
ansible.builtin.copy:
src: 'systemd_override.conf'
dest: /etc/systemd/system/nginx.service.d/override.conf
mode: "0644"
tags: nginx
notify:
- reload systemd
2 changes: 1 addition & 1 deletion roles/pulmap/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ galaxy_info:
platforms:
- name: Ubuntu
versions:
- 18.04
- bionic
dependencies:
- role: "samba"
- role: "redis"
Expand Down
14 changes: 11 additions & 3 deletions roles/pulmap/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@ lint: |
ansible-lint
platforms:
- name: instance
image: "quay.io/pulibrary/jammy-ansible:latest"
command: ""
image: "ghcr.io/pulibrary/pul_containers:jammy_multi"
command: "/lib/systemd/systemd"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
tmpfs:
- /tmp
- /run
- /run/lock
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
name: ansible
config_options:
defaults:
remote_tmp: /tmp
log: true
verifier:
name: ansible
4 changes: 0 additions & 4 deletions roles/redis/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
dest: /etc/apt/sources.list.d/redis.list
mode: '0644'

- name: Redis | update apt cache
ansible.builtin.apt:
update_cache: true

- name: Redis | install redis packages
ansible.builtin.apt:
name: "{{ redis_packages }}"
Expand Down
3 changes: 1 addition & 2 deletions roles/sidekiq_worker/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ galaxy_info:
platforms:
- name: Ubuntu
versions:
- 16.04
- 18.04
- bionic

dependencies:
- role: rails_app
14 changes: 11 additions & 3 deletions roles/sneakers_worker/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@ lint: |
ansible-lint
platforms:
- name: instance
image: "quay.io/pulibrary/jammy-ansible:latest"
command: ""
image: "ghcr.io/pulibrary/pul_containers:jammy_multi"
command: "/lib/systemd/systemd"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
tmpfs:
- /tmp
- /run
- /run/lock
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
name: ansible
config_options:
defaults:
remote_tmp: /tmp
log: true
verifier:
name: ansible
8 changes: 4 additions & 4 deletions roles/sneakers_worker/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
- name: sneakers_worker | Install startup script for sneakers workers
- name: Sneakers_worker | Install startup script for sneakers workers
ansible.builtin.template:
src: sneakers.service
dest: "/etc/systemd/system/{{ sneakers_worker_name }}.service"
mode: 0644
mode: "0644"
notify: 'restart sneakers worker'

- name: sneakers_worker | Keep workers running
- name: Sneakers_worker | Keep workers running
ansible.builtin.service:
name: "{{ sneakers_worker_name }}"
enabled: true
state: started
when: running_on_server

- name: sneakers_worker Allow deploy user to restart workers
- name: Sneakers_worker Allow deploy user to restart workers
ansible.builtin.lineinfile:
dest: /etc/sudoers
state: present
Expand Down

0 comments on commit 7a433de

Please sign in to comment.