From 63611ee1ae59977a5d20d650d5611fff4adff0ea Mon Sep 17 00:00:00 2001 From: lavenderguitar Date: Fri, 18 Mar 2022 23:52:44 -0400 Subject: [PATCH 1/5] [201] Trailing whitespace --- tasks/dependencies.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/dependencies.yml b/tasks/dependencies.yml index 47f8409..0d55f1b 100644 --- a/tasks/dependencies.yml +++ b/tasks/dependencies.yml @@ -15,14 +15,14 @@ url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" state: present become: yes - + - name: uptime_kuma | nodejs | Add NodeSource repository apt_repository: repo: deb https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main state: present filename: 'nodesource' become: yes - + - name: uptime_kuma | nodejs | Add NodeSource src repository apt_repository: repo: deb-src https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main -- 2.25.1 From eaac4d115a605ee0acfd8b5ab1607310385838ff Mon Sep 17 00:00:00 2001 From: lavenderguitar Date: Fri, 18 Mar 2022 23:53:25 -0400 Subject: [PATCH 2/5] [601] Don't compare to literal True/False --- tasks/dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/dependencies.yml b/tasks/dependencies.yml index 0d55f1b..4525b3f 100644 --- a/tasks/dependencies.yml +++ b/tasks/dependencies.yml @@ -36,4 +36,4 @@ state: latest update-cache: yes become: yes - when: kuma__install_nodejs == true \ No newline at end of file + when: kuma__install_nodejs | bool \ No newline at end of file -- 2.25.1 From c4e7412708e2a9738049282c278eb9324200a47e Mon Sep 17 00:00:00 2001 From: lavenderguitar Date: Fri, 18 Mar 2022 23:54:00 -0400 Subject: [PATCH 3/5] [501] become_user requires become to work as expected --- tasks/configure.yml | 50 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/tasks/configure.yml b/tasks/configure.yml index 97cf99d..68c09ee 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,31 +1,29 @@ --- -- name: kuma | Setup kuma - command: npm run setup - args: - chdir: "{{ kuma__path }}" - become_user: "{{ kuma__user }}" +- block: + - name: kuma | Setup kuma + command: npm run setup + args: + chdir: "{{ kuma__path }}" -- name: kuma | Clear all pm2 apps - command: pm2 delete all - args: - chdir: "{{ kuma__path }}" - become_user: "{{ kuma__user }}" + - name: kuma | Clear all pm2 apps + command: pm2 delete all + args: + chdir: "{{ kuma__path }}" -- name: kuma | Create systemd startup script - command: env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u {{ kuma__user }} --hp /home/{{ kuma__user }} - args: - chdir: "{{ kuma__path }}" - become: yes - become_user: "{{ kuma__user }}" + - name: kuma | Create systemd startup script + command: env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u {{ kuma__user }} --hp /home/{{ kuma__user }} + args: + chdir: "{{ kuma__path }}" + become: yes -- name: kuma | Start kuma - command: pm2 start server/server.js --name kuma - args: - chdir: "{{ kuma__path }}" - become_user: "{{ kuma__user }}" + - name: kuma | Start kuma + command: pm2 start server/server.js --name kuma + args: + chdir: "{{ kuma__path }}" -- name: kuma | Ensure pm2 startup configuration is enabled for reboots. - command: pm2 save - args: - chdir: "{{ kuma__path }}" - become_user: "{{ kuma__user }}" \ No newline at end of file + - name: kuma | Ensure pm2 startup configuration is enabled for reboots. + command: pm2 save + args: + chdir: "{{ kuma__path }}" + become_user: "{{ kuma__user }}" + become: yes \ No newline at end of file -- 2.25.1 From 5cbbc6f576d30f55400e837d1d1a8876ae82da42 Mon Sep 17 00:00:00 2001 From: lavenderguitar Date: Fri, 18 Mar 2022 23:58:33 -0400 Subject: [PATCH 4/5] Fix names --- tasks/configure.yml | 10 +++++----- tasks/dependencies.yml | 8 ++++---- tasks/install.yml | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tasks/configure.yml b/tasks/configure.yml index 68c09ee..cfac03f 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,27 +1,27 @@ --- - block: - - name: kuma | Setup kuma + - name: uptime_kuma | configure | Setup kuma command: npm run setup args: chdir: "{{ kuma__path }}" - - name: kuma | Clear all pm2 apps + - name: uptime_kuma | configure | Clear all pm2 apps command: pm2 delete all args: chdir: "{{ kuma__path }}" - - name: kuma | Create systemd startup script + - name: uptime_kuma | configure | Create systemd startup script command: env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u {{ kuma__user }} --hp /home/{{ kuma__user }} args: chdir: "{{ kuma__path }}" become: yes - - name: kuma | Start kuma + - name: uptime_kuma | configure | Start kuma command: pm2 start server/server.js --name kuma args: chdir: "{{ kuma__path }}" - - name: kuma | Ensure pm2 startup configuration is enabled for reboots. + - name: uptime_kuma | configure | Ensure pm2 startup configuration is enabled for reboots. command: pm2 save args: chdir: "{{ kuma__path }}" diff --git a/tasks/dependencies.yml b/tasks/dependencies.yml index 4525b3f..4d8e6d7 100644 --- a/tasks/dependencies.yml +++ b/tasks/dependencies.yml @@ -10,27 +10,27 @@ become: yes - block: - - name: uptime_kuma | nodejs | add NodeSource apt key + - name: uptime_kuma | dependencies | nodejs | add NodeSource apt key apt_key: url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" state: present become: yes - - name: uptime_kuma | nodejs | Add NodeSource repository + - name: uptime_kuma | dependencies | nodejs | Add NodeSource repository apt_repository: repo: deb https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main state: present filename: 'nodesource' become: yes - - name: uptime_kuma | nodejs | Add NodeSource src repository + - name: uptime_kuma | dependencies | nodejs | Add NodeSource src repository apt_repository: repo: deb-src https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main state: present filename: 'nodesource' become: yes - - name: uptime_kuma | nodejs | Install NodeJS + - name: uptime_kuma | dependencies | nodejs | Install NodeJS apt: name: nodejs state: latest diff --git a/tasks/install.yml b/tasks/install.yml index 6d01e0d..3a13f3b 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,10 +1,10 @@ --- -- name: uptime_kuma | add_user | Ensure kuma group exists +- name: uptime_kuma | install | add_user | Ensure kuma group exists group: name: "{{ kuma__group }}" state: present -- name: uptime_kuma | add_user | Add kuma user +- name: uptime_kuma | install | add_user | Add kuma user user: name: "{{ kuma__user }}" group: "{{ kuma__group }}" @@ -13,7 +13,7 @@ shell: /bin/bash become: yes -- name: kuma | Clone kuma repo +- name: uptime_kuma | install | Clone kuma repo git: repo: "{{ kuma__repo }}" dest: "{{ kuma__path }}" @@ -21,13 +21,13 @@ group: "{{ kuma__group }}" become: yes -- name: kuma | Install package dependencies +- name: uptime_kuma | install | Install package dependencies npm: path: "{{ kuma__path }}" state: present become_user: "{{ kuma__user }}" -- name: kuma | Install pm2 +- name: uptime_kuma | install | Install pm2 npm: name: pm2 state: present -- 2.25.1 From 36f2002a7eb6070230d7297eab68b7b77dcd0819 Mon Sep 17 00:00:00 2001 From: lavenderguitar Date: Sat, 19 Mar 2022 00:00:52 -0400 Subject: [PATCH 5/5] [501] become_user requires become to work as expected --- tasks/install.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/install.yml b/tasks/install.yml index 3a13f3b..66dd8eb 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -25,6 +25,7 @@ npm: path: "{{ kuma__path }}" state: present + become: yes become_user: "{{ kuma__user }}" - name: uptime_kuma | install | Install pm2 -- 2.25.1