Browse Source

readme.md with projects index

sys-systemd-and-upstart
Vladimir Smagin 7 months ago
parent
commit
2e25b00064
34 changed files with 10 additions and 408 deletions
  1. 0
    2
      keys-ansible/.gitignore
  2. 0
    4
      keys-ansible/ansible.cfg
  3. 0
    4
      keys-ansible/group_vars/hetzner-nodes.yml
  4. 0
    6
      keys-ansible/group_vars/hetzner.yml
  5. 0
    3
      keys-ansible/host_vars/monitor.yml
  6. 0
    15
      keys-ansible/inventory.ini
  7. 0
    41
      keys-ansible/readme.md
  8. 0
    1
      keys-ansible/roles/master_key/meta/main.yml
  9. 0
    7
      keys-ansible/roles/master_key/tasks/main.yml
  10. 0
    1
      keys-ansible/roles/preinstall/meta/main.yml
  11. 0
    18
      keys-ansible/roles/preinstall/tasks/main.yml
  12. 0
    1
      keys-ansible/roles/ssh_access/meta/main.yml
  13. 0
    21
      keys-ansible/roles/ssh_access/tasks/main.yml
  14. 0
    27
      keys-ansible/secrets/superkey.key
  15. 0
    1
      keys-ansible/secrets/superkey.pub
  16. 0
    3
      keys-ansible/ssh-keys.sh
  17. 0
    7
      keys-ansible/ssh-keys.yml
  18. 0
    3
      nginx+php-fpm7.1/ansible.cfg
  19. 0
    3
      nginx+php-fpm7.1/deploy.sh
  20. 0
    11
      nginx+php-fpm7.1/deploy.yml
  21. 0
    16
      nginx+php-fpm7.1/roles/nginx/tasks/main.yml
  22. 0
    65
      nginx+php-fpm7.1/roles/php/tasks/main.yml
  23. 0
    12
      nginx+php-fpm7.1/roles/preinstall/tasks/main.yml
  24. 10
    0
      readme.md
  25. 0
    17
      systemd-and-upstart/inventory.ini
  26. 0
    10
      systemd-and-upstart/roles/preinstall/tasks/main.yml
  27. 0
    13
      systemd-and-upstart/roles/set_service/files/app.py
  28. 0
    12
      systemd-and-upstart/roles/set_service/files/child_process.py
  29. 0
    30
      systemd-and-upstart/roles/set_service/tasks/main.yml
  30. 0
    15
      systemd-and-upstart/roles/set_service/templates/systemd-service.template.j2
  31. 0
    25
      systemd-and-upstart/roles/set_service/templates/upstart-service.template.j2
  32. 0
    4
      systemd-and-upstart/roles/set_service/vars/main.yml
  33. 0
    4
      systemd-and-upstart/roles/test/tasks/main.yml
  34. 0
    6
      systemd-and-upstart/services.yml

+ 0
- 2
keys-ansible/.gitignore View File

@@ -1,2 +0,0 @@
1
-*.log
2
-*.retry

+ 0
- 4
keys-ansible/ansible.cfg View File

@@ -1,4 +0,0 @@
1
-[defaults] 
2
-log_path=ansible.log
3
-nocows = 1
4
-hash_behaviour = merge

+ 0
- 4
keys-ansible/group_vars/hetzner-nodes.yml View File

@@ -1,4 +0,0 @@
1
-access_list:
2
-  git: { keypath: "../keys/project-git.pub", username: "root" }
3
-  dev1: { keypath: "../keys/developer1.pub", username: "root" }
4
-  dev2: { keypath: "../keys/developer2.pub", username: "root" }

+ 0
- 6
keys-ansible/group_vars/hetzner.yml View File

@@ -1,6 +0,0 @@
1
-access_list:
2
-  admin: { keypath: "../keys/admin.pub", username: "root" }
3
-  techguy: { keypath: "../keys/techguy.pub", username: "root" }
4
-  interserver: { keypath: "../keys/interserver.pub", username: "root" }
5
-secret_list:
6
-  interserver: { keypath: "../keys/interserver.pem", username: "root" }

+ 0
- 3
keys-ansible/host_vars/monitor.yml View File

@@ -1,3 +0,0 @@
1
-access_list:
2
-  admin: { keypath: "../keys/admin.pub", username: "root" }
3
-  techguy: { keypath: "../keys/techguy.pub", username: "root" }

+ 0
- 15
keys-ansible/inventory.ini View File

@@ -1,15 +0,0 @@
1
-[monitoring]
2
-monitor ansible_host=44.165.225.144 ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
3
-
4
-[hetzner:children]
5
-hetzner-balancers
6
-hetzner-nodes
7
-
8
-[hetzner-nodes]
9
-hetzner-node0 ansible_host=145.251.216.112 ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
10
-hetzner-node1 ansible_host=154.64.4.185 ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
11
-hetzner-node2 ansible_host=168.251.172.244 ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
12
-
13
-[hetzner-balancers]
14
-hetzner-balancer0 ansible_host=145.251.216.154 ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"
15
-hetzner-balancer1 ansible_host=78.46.246.78 ansible_user=root ansible_ssh_private_key_file="secrets/superkey.pem"

+ 0
- 41
keys-ansible/readme.md View File

@@ -1,41 +0,0 @@
1
-# Ansible centralized keys management
2
-
3
-Dicts in parent group merges with dicts in child groups. 
4
-
5
-Warning! Playbook will delete all public keys in root's ```.ssh/authorized_keys``` file and setup own **super** key, only after this public keys in group_vars and host_vars will be added into assigned users ```.ssh/authorized_keys``` files.
6
-
7
-**Security issue!** You need to generate your own super key! Run ```ssh-keygen -f superkey``` and replace keys in ```secret/``` directory.
8
-
9
-Infrastructure:
10
-
11
-```
12
---[ hetzner ]--\
13
-               |- hetzner-balancers
14
-               \- hetzner-nodes
15
-```
16
-
17
-All servers will be available to the administrator and assistant, servers must have own internal key for files copying. Configuring parent ```hetzner```group:
18
-
19
-```
20
-    access_list:
21
-      admin: { keypath: "../keys/admin.pub", username: "root" }
22
-      techguy: { keypath: "../keys/techguy.pub", username: "root" }
23
-      interserver: { keypath: "../keys/interserver.pub", username: "root" }
24
-
25
-    secret_list:
26
-      interserver: { keypath: "../keys/interserver.pem", username: "root" }
27
-```
28
-
29
-You want to make additional access to all nodes for developer guy. Configuring child ```hetzner-nodes``` group:
30
-
31
-```
32
-    access_list:
33
-      developer: { keypath: "../keys/developer.pub", username: "dev" }
34
-```
35
-
36
-No need to make additional config for ```hetzner-balancers``` because access list will be inherited, only admins accessible.
37
-
38
----
39
-Copyright by Vladimir Smagin, 2018
40
-http://blindage.org
41
-21h@blindage.org

+ 0
- 1
keys-ansible/roles/master_key/meta/main.yml View File

@@ -1 +0,0 @@
1
-allow_duplicates: true

+ 0
- 7
keys-ansible/roles/master_key/tasks/main.yml View File

@@ -1,7 +0,0 @@
1
----
2
-- name: Set primary ansible key and remove others
3
-  authorized_key:
4
-    user: root
5
-    state: present
6
-    exclusive: True
7
-    key: "{{ lookup('file', 'secrets/superkey.pub') }}"

+ 0
- 1
keys-ansible/roles/preinstall/meta/main.yml View File

@@ -1 +0,0 @@
1
-allow_duplicates: true

+ 0
- 18
keys-ansible/roles/preinstall/tasks/main.yml View File

@@ -1,18 +0,0 @@
1
----
2
-- name: Minimum packages for Debian-like
3
-  apt: name="{{ item }}" state=present update_cache=yes
4
-  become: yes
5
-  with_items:
6
-    - mc
7
-    - htop 
8
-  when: (ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian') and preinstall is defined
9
-
10
-- name: Minimum packages for RedHat-like
11
-  become: yes
12
-  yum: name="{{ item }}" state=present update_cache=yes
13
-  with_items:
14
-    - mc
15
-    - htop
16
-  when: (ansible_distribution == 'Red Hat' or ansible_distribution == 'Centos') and preinstall is defined
17
-
18
-

+ 0
- 1
keys-ansible/roles/ssh_access/meta/main.yml View File

@@ -1 +0,0 @@
1
-allow_duplicates: true

+ 0
- 21
keys-ansible/roles/ssh_access/tasks/main.yml View File

@@ -1,21 +0,0 @@
1
----
2
-#- debug:
3
-#    msg: "{{ access_list }}"
4
-  
5
-- name: Set public keys
6
-  become: true
7
-  become_user: "{{ item.value.username }}"
8
-  authorized_key: user="{{ item.value.username }}" key="{{ lookup('file', item.value.keypath) }}" state=present
9
-  with_dict: "{{ access_list }}"
10
-  when: access_list != None and access_list is defined
11
-
12
-#- debug:
13
-#    msg: "{{ secret_list }}"
14
-
15
-- name: Upload secret keys
16
-  become: true
17
-  become_user: "{{ item.value.username }}"
18
-  copy: src="{{ item.value.keypath }}" dest="~/.ssh/{{ item.value.keypath | basename }}" mode=0600
19
-  with_dict: "{{ secret_list }}"
20
-  when: secret_list != None and secret_list is defined
21
-

+ 0
- 27
keys-ansible/secrets/superkey.key View File

@@ -1,27 +0,0 @@
1
------BEGIN RSA PRIVATE KEY-----
2
-MIIEpAIBAAKCAQEAwNv29GRDfroj6Ue5iPsj/E5nX7QWRPzfHIj8pMms3+YY/rt6
3
-em077AXFGQITr874Y5tnjS7joO1LnOU71D/Yy80ty4kqL56U20OBGLrFxv/swJgf
4
-QweSv9nFkj+sEONqu/kM7Ailu4sOkcAzH/aA8tLVpAyC5xf+wYhtX3twUkbSPgpG
5
-N6hV/TaNMt27moWwOMui0Hm6EYriPYBD7c7wHwgLwkksq+SLLHDqJqiWrBSRnwCv
6
-KBAIpMyqwhjLICk7LyuAZdXF+LdJXssXLnnpwl1HspkRt/QhbznRqyLqdD6pfVRv
7
-yRalZxK7xv8akYlCzzWgCHGbw98KexUBLcw8oQIDAQABAoIBAFcjS7pyjth0bANc
8
-B+Vva3v1RNnF+YXkJz6yWkxuXvCu+z4lIRqtvjRPCxXYjWKTBkGjFq+ArxKoBND3
9
-9gdZba/vnbBn4iqv4RwMrQiqYvAd9C+0y/MyOcj7MTx6Dll3F2OlDISdB5zsIIIU
10
-MEVR0ENmpWbAzGhzvARfiuNoV4CkfCMk8+1l5m0eLuFih74IW3Ka62tUx6DUIl9/
11
-KTsgFqsGY7if6RomEWJssoDWYhfVpy2PyIR9Rvs3sTSKXKlHAZIewTbiwsjsknjw
12
-8x6eJpi6KogZ2jsgmjOzAUkyAjFm5+Su7l0H58nJk6V0b4eskXGZD4nzzmUSmjEw
13
-L1MmW90CgYEA59RpCp3t0MGX5IPkKezaCXC6uvP1cUPKIcz9MrYDDzX4mWUIiKza
14
-hyPPllmV75sUk11/bMcwOlYiRlpwCRq6Wh5BV3D34/YSNF7gOyUkNrEWt04UAlSD
15
-pwEP8RMv+GXhPGfWJrhuF3zTYoWy8347LKuKgkLxDgWYwvYaJTXMVDsCgYEA1Pds
16
-Poup+X8eOOtF80w8T7joTEI4TM0h7LdJnK8Don99jG4dQdgXB/r8qsCSkjHG6nkn
17
-6qsJXEULybxuc4qD444LwNWAVVxHE6e69plW5jtzO5ZXEEMFOpBawAZDIOtiePUr
18
-ZrXp4X48o429XWBenZPJZmtCFCnd8943AEkLcNMCgYEAocEMNZMx3qllMNVxumr/
19
-Svzz3QPhKlFRVLoxpFNo2REgTu82wB5TL12mNtJ1EkSTW6suAJkOpnV43ru1VjTm
20
-94AKuVciL1V/KDlWnQ3yMZLoNaftwB516W2NUPjBTMDRIhOVUVj3v72hxCljTg+y
21
-fB2IvBC3HsB68PVEEthxpAcCgYA+3N39xFojBGvWX1RhkcJHwgwH3pAh03dNGXlI
22
-H70R7VIQ7rwCIJgDygllGbzqHHlb4vFuapgzvUnSfaWYw21U8Sv0+tCL4dY1LhCZ
23
-FAA7q5bDIwiGC1JyzAONpQuRnwmNLMln4xCreAjMOl2IP5cOKn6LleOGcilK/+/6
24
-TJVs8wKBgQDSOzTch2lQViWQhSFO2nnQ5Os7nLhQGhWLQP+L6JJiTIeAv0oITyQC
25
-IVOzsysepQYnm/bSHDXRHpzYR/Cq2FJIIPKvBIHuh60zqhpfpG97+fCibRFfWcoe
26
-DFR+2w5mcReEHjwAT5dVBfYVlLb75Zmu7P0/C4KG6DGtRNxEGSjUSw==
27
------END RSA PRIVATE KEY-----

+ 0
- 1
keys-ansible/secrets/superkey.pub View File

@@ -1 +0,0 @@
1
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDA2/b0ZEN+uiPpR7mI+yP8TmdftBZE/N8ciPykyazf5hj+u3p6bTvsBcUZAhOvzvhjm2eNLuOg7Uuc5TvUP9jLzS3LiSovnpTbQ4EYusXG/+zAmB9DB5K/2cWSP6wQ42q7+QzsCKW7iw6RwDMf9oDy0tWkDILnF/7BiG1fe3BSRtI+CkY3qFX9No0y3buahbA4y6LQeboRiuI9gEPtzvAfCAvCSSyr5IsscOomqJasFJGfAK8oEAikzKrCGMsgKTsvK4Bl1cX4t0leyxcueenCXUeymRG39CFvOdGrIup0Pql9VG/JFqVnErvG/xqRiULPNaAIcZvD3wp7FQEtzDyh demo key. do not use it!

+ 0
- 3
keys-ansible/ssh-keys.sh View File

@@ -1,3 +0,0 @@
1
-#!/bin/bash
2
-
3
-ansible-playbook ssh-keys.yml -i inventory.ini

+ 0
- 7
keys-ansible/ssh-keys.yml View File

@@ -1,7 +0,0 @@
1
----
2
-- hosts: all
3
-  gather_facts: True
4
-  roles:
5
-    - master_key
6
-    - preinstall
7
-    - ssh_access

+ 0
- 3
nginx+php-fpm7.1/ansible.cfg View File

@@ -1,3 +0,0 @@
1
-[defaults] 
2
-log_path=ansible.log
3
-nocows = 1

+ 0
- 3
nginx+php-fpm7.1/deploy.sh View File

@@ -1,3 +0,0 @@
1
-#!/bin/bash
2
-
3
-ansible-playbook deploy.yml -i '10.0.2.46,' -T 30 -k -u root

+ 0
- 11
nginx+php-fpm7.1/deploy.yml View File

@@ -1,11 +0,0 @@
1
----
2
-- hosts: all
3
-  gather_facts: True
4
-  vars: 
5
-    ansible_python_interpreter: /usr/bin/python3
6
-    #validate_certs: False
7
-
8
-  roles:
9
-    - preinstall
10
-    - php
11
-    - nginx

+ 0
- 16
nginx+php-fpm7.1/roles/nginx/tasks/main.yml View File

@@ -1,16 +0,0 @@
1
----
2
-- name: Add an apt signing key for nginx and repository
3
-  apt_key:
4
-    url: http://nginx.org/keys/nginx_signing.key
5
-    state: present
6
-
7
-- apt_repository:
8
-    repo: deb http://nginx.org/packages/ubuntu/ {{ ansible_lsb.codename }} nginx
9
-    state: present
10
-    filename: nginx
11
-
12
-- name: Install nginx
13
-  apt: name=nginx state=present
14
-
15
-- name: Restart nginx
16
-  service: name=nginx state=restarted

+ 0
- 65
nginx+php-fpm7.1/roles/php/tasks/main.yml View File

@@ -1,65 +0,0 @@
1
----
2
-- apt_repository:
3
-    validate_certs: False
4
-    repo: ppa:ondrej/php
5
-    state: present
6
-
7
-- name: Install php-fpm and deps
8
-  apt: name={{ item }} state=present update_cache=yes
9
-  with_items:
10
-    - php7.1
11
-    - php7.1-fpm
12
-    - php7.1-mbstring
13
-    - php7.1-xml
14
-    - php7.1-curl
15
-    - php7.1-pgsql
16
-    - php7.1-mysql
17
-    - php7.1-gd
18
-    - php7.1-zip
19
-    - php7.1-opcache
20
-    - php7.1-memcached
21
-
22
-- ini_file: 
23
-    path: /etc/php/7.1/fpm/pool.d/www.conf
24
-    section: www
25
-    option: user
26
-    value: www-data
27
-    backup: no
28
-
29
-- ini_file:
30
-    path: /etc/php/7.1/fpm/pool.d/www.conf
31
-    section: www
32
-    option: group
33
-    value: www-data
34
-    backup: no
35
-
36
-- ini_file: 
37
-    path: /etc/php/7.1/fpm/php.ini
38
-    section: PHP
39
-    option: short_open_tag
40
-    value: "On"
41
-    backup: no
42
-
43
-- ini_file: 
44
-    path: /etc/php/7.1/fpm/php.ini
45
-    section: PHP
46
-    option: max_execution_time
47
-    value: 300
48
-    backup: no
49
-
50
-- ini_file: 
51
-    path: /etc/php/7.1/fpm/php.ini
52
-    section: PHP
53
-    option: max_input_time
54
-    value: 300
55
-    backup: no
56
-
57
-- ini_file: 
58
-    path: /etc/php/7.1/fpm/php.ini
59
-    section: PHP
60
-    option: memory_limit
61
-    value: 512M
62
-    backup: no
63
-
64
-- name: Restart php-fpm
65
-  service: name=php7.1-fpm state=restarted

+ 0
- 12
nginx+php-fpm7.1/roles/preinstall/tasks/main.yml View File

@@ -1,12 +0,0 @@
1
----
2
-- name: Ensure packages are installed
3
-  apt: name={{ item }} state=present update_cache=yes
4
-  with_items:
5
-    - python
6
-    - mc
7
-    - htop 
8
-    - iotop
9
-    - wget
10
-    - curl
11
-- set_fact: 
12
-    ansible_python_interpreter: /usr/bin/python

+ 10
- 0
readme.md View File

@@ -0,0 +1,10 @@
1
+# My useful ansible playbooks
2
+
3
+System management:
4
+
5
+- [Centralized SSH keys management](https://git.blindage.org/21h/ansible-library/src/branch/keys-ansible)
6
+- [Create systemd and upstart scripts](https://git.blindage.org/21h/ansible-library/src/branch/systemd-and-upstart)
7
+
8
+Web deployment:
9
+
10
+- [PHP 7.1 FPM + Nginx](https://git.blindage.org/21h/ansible-library/src/branch/nginx+php-fpm7.1)

+ 0
- 17
systemd-and-upstart/inventory.ini View File

@@ -1,17 +0,0 @@
1
-[upstart:children]
2
-upstart-desktops
3
-upstart-servers
4
-
5
-[upstart-desktops]
6
-desk1204 ansible_host=10.9.0.50 ansible_user=vlad ansible_password=123 ansible_sudo_password=123
7
-desk1404 ansible_host=10.9.0.51 ansible_user=vlad ansible_password=123 ansible_sudo_password=123
8
-
9
-[upstart-servers]
10
-serv1204 ansible_host=10.9.0.48 ansible_user=vlad ansible_password=123 ansible_sudo_password=123
11
-serv1404 ansible_host=10.9.0.49 ansible_user=vlad ansible_password=123 ansible_sudo_password=123
12
-
13
-[systemd:children]
14
-systemd-desktops
15
-
16
-[systemd-desktops]
17
-desk1804 ansible_host=10.9.0.155 ansible_user=vlad ansible_password=123 ansible_sudo_password=123

+ 0
- 10
systemd-and-upstart/roles/preinstall/tasks/main.yml View File

@@ -1,10 +0,0 @@
1
----
2
-- name: Minimum packages for Debian-like
3
-  apt: name="{{ item }}" state=present update_cache=yes
4
-  become: yes
5
-  become_method: sudo
6
-  with_items:
7
-    - python
8
-    - mc
9
-    - htop
10
-  when: preinstall is defined

+ 0
- 13
systemd-and-upstart/roles/set_service/files/app.py View File

@@ -1,13 +0,0 @@
1
-import time
2
-import multiprocessing
3
-import child_process
4
-
5
-
6
-print("Hello world")
7
-
8
-processes = [None] * 4
9
-for i in range(4):
10
-    processes[i] = multiprocessing.Process(target=child_process.run, args=(i,))
11
-    processes[i].start()
12
-for i in range(4):
13
-    processes[i].join()

+ 0
- 12
systemd-and-upstart/roles/set_service/files/child_process.py View File

@@ -1,12 +0,0 @@
1
-import time
2
-import multiprocessing
3
-
4
-def test(info):
5
-    while 1:
6
-	print 'TEST', info[0], info[1]
7
-
8
-def run(proc_id):
9
-    pool = multiprocessing.Pool(processes=4)
10
-    pool.map(test, [(proc_id, i) for i in range(4)])
11
-    pool.close()
12
-    pool.join()

+ 0
- 30
systemd-and-upstart/roles/set_service/tasks/main.yml View File

@@ -1,30 +0,0 @@
1
----
2
-- name: Install app.py
3
-  copy:
4
-    src: files/app.py
5
-    dest: /opt/app.py
6
-    owner: root
7
-    group: root
8
-    mode: 0644
9
-
10
-- name: Install child_process.py
11
-  copy:
12
-    src: files/child_process.py
13
-    dest: /opt/child_process.py
14
-    owner: root
15
-    group: root
16
-    mode: 0644
17
-
18
-- name: Create service file for upstart Ubuntu versions
19
-  template: src=upstart-service.template.j2 dest=/etc/init/{{service_name}}.conf backup=no mode=0644
20
-  when: ansible_distribution == 'Ubuntu' and (ansible_distribution_version == "14.04" or ansible_distribution_version == "12.04")
21
-
22
-- name: Create service file for systemd Ubuntu versions
23
-  template: src=systemd-service.template.j2 dest=/etc/systemd/system/{{service_name}}.service backup=no mode=0644
24
-  when: ansible_distribution == 'Ubuntu' and (ansible_distribution_version == "16.04" or ansible_distribution_version == "18.04")
25
-
26
-- name: Enable service {{ service_name }}
27
-  service: name={{ service_name }} enabled=yes
28
-
29
-- name: Start service {{ service_name }}
30
-  service: name={{ service_name }} state=restarted

+ 0
- 15
systemd-and-upstart/roles/set_service/templates/systemd-service.template.j2 View File

@@ -1,15 +0,0 @@
1
-[Unit]
2
-Description={{service_description}}
3
-Requires=network.target
4
-After=syslog.target network.target
5
-TimeoutStopSpec=60
6
-[Service]
7
-Type=simple
8
-ExecStart={{interpretator}} {{installation_path}}/app.py
9
-ExecReload=/bin/kill -HUP $MAINPID
10
-WorkingDirectory={{installation_path}}
11
-User=vlad
12
-Restart=always
13
-RestartSec=30
14
-[Install]
15
-WantedBy=multi-user.target

+ 0
- 25
systemd-and-upstart/roles/set_service/templates/upstart-service.template.j2 View File

@@ -1,25 +0,0 @@
1
-description "{{ service_description }}"
2
-
3
-start on runlevel [2345]
4
-stop on runlevel [!2345]
5
-
6
-expect fork
7
-kill timeout 60 # when upstart issued a stop, send SIGTERM, wait 60 sec before sending SIGKILL
8
-
9
-respawn
10
-respawn limit 5 30 #try 5 times within 60 seconds, or giveup
11
-
12
-script
13
-    echo $$ > {{installation_path}}/app.pid
14
-    exec {{ interpretator }} {{ installation_path}}/app.py
15
-end script
16
-
17
-pre-start script
18
-    touch {{installation_path}}/app.log
19
-    echo "\n[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> {{installation_path}}/app.log
20
-end script
21
-
22
-pre-stop script
23
-    rm -f {{installation_path}}/app.pid
24
-    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> {{installation_path}}/app.log
25
-end script

+ 0
- 4
systemd-and-upstart/roles/set_service/vars/main.yml View File

@@ -1,4 +0,0 @@
1
-service_name: app
2
-service_description: my app.py
3
-installation_path: /opt
4
-interpretator: /usr/bin/python

+ 0
- 4
systemd-and-upstart/roles/test/tasks/main.yml View File

@@ -1,4 +0,0 @@
1
----
2
-- name: test
3
-  debug:
4
-    msg: "OS Version: {{ansible_distribution }} {{ansible_distribution_release}} {{ansible_distribution_version}}"

+ 0
- 6
systemd-and-upstart/services.yml View File

@@ -1,6 +0,0 @@
1
-- hosts: all
2
-  roles:
3
-    - test
4
-    - preinstall
5
-    - { role: set_service, become: yes }
6
-

Loading…
Cancel
Save