First draft for ATON role (WIP)
This commit is contained in:
10
playbooks/aton_servers.yml
Normal file
10
playbooks/aton_servers.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- name: Configure webserver with NodeJS, Aton and nginx
|
||||||
|
hosts:
|
||||||
|
- debi13
|
||||||
|
become: true
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- nodejs
|
||||||
|
- aton
|
||||||
|
- nginx
|
||||||
1
roles/aton/defaults/main.yml
Normal file
1
roles/aton/defaults/main.yml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
aton_repo_url: "https://github.com/phoenixbf/aton.git"
|
||||||
41
roles/aton/tasks/main.yml
Normal file
41
roles/aton/tasks/main.yml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure git is installed
|
||||||
|
ansible.builtin.package:
|
||||||
|
name:
|
||||||
|
- git
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Create ATON app user
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: aton
|
||||||
|
shell: /usr/sbin/nologin
|
||||||
|
home: /opt/aton-user
|
||||||
|
create_home: true
|
||||||
|
password: '*'
|
||||||
|
|
||||||
|
- name: Ensure ATON directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /opt/aton-user/aton
|
||||||
|
state: directory
|
||||||
|
owner: aton
|
||||||
|
group: aton
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Clone ATON repo
|
||||||
|
ansible.builtin.git:
|
||||||
|
repo: "{{ aton_repo_url }}"
|
||||||
|
dest: /opt/aton-user/aton
|
||||||
|
clone: true
|
||||||
|
become: true
|
||||||
|
become_user: aton
|
||||||
|
|
||||||
|
- name: Install NPM dependencies
|
||||||
|
community.general.npm:
|
||||||
|
ci: true
|
||||||
|
path: /opt/aton-user/aton
|
||||||
|
state: present
|
||||||
|
become: true
|
||||||
|
become_user: aton
|
||||||
|
|
||||||
3
roles/nodejs/defaults/main.yml
Normal file
3
roles/nodejs/defaults/main.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
nodejs_major_version: "22"
|
||||||
|
nodesource_gpg_key_url: "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key"
|
||||||
|
nodesource_repo_base: "https://deb.nodesource.com/node_{{ nodejs_major_version }}.x"
|
||||||
31
roles/nodejs/tasks/main.yml
Normal file
31
roles/nodejs/tasks/main.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
- name: Install Debian prerequisites
|
||||||
|
ansible.builtin.package:
|
||||||
|
name:
|
||||||
|
- ca-certificates
|
||||||
|
- curl
|
||||||
|
- gnupg
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Add NodeSource GPG key
|
||||||
|
get_url:
|
||||||
|
url: "{{ nodesource_gpg_key_url }}"
|
||||||
|
dest: /usr/share/keyrings/nodesource.gpg
|
||||||
|
mode: "0644"
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Add NodeSource APT repository
|
||||||
|
apt_repository:
|
||||||
|
repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/nodesource.gpg] {{ nodesource_repo_base }} nodistro main"
|
||||||
|
filename: nodesource
|
||||||
|
state: present
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Install NodeJS from NodeSource
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: nodejs
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
Reference in New Issue
Block a user