mirror of
https://github.com/Crocmagnon/ansible.git
synced 2024-11-22 07:18:02 +01:00
Compare commits
No commits in common. "06630d79fd860b4cd9069232acec56243753c71a" and "59711291763db0b358b7c50898b754f474faf7f4" have entirely different histories.
06630d79fd
...
5971129176
9 changed files with 8 additions and 153 deletions
24
LICENSE
24
LICENSE
|
@ -1,24 +0,0 @@
|
||||||
This is free and unencumbered software released into the public domain.
|
|
||||||
|
|
||||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
||||||
distribute this software, either in source code form or as a compiled
|
|
||||||
binary, for any purpose, commercial or non-commercial, and by any
|
|
||||||
means.
|
|
||||||
|
|
||||||
In jurisdictions that recognize copyright laws, the author or authors
|
|
||||||
of this software dedicate any and all copyright interest in the
|
|
||||||
software to the public domain. We make this dedication for the benefit
|
|
||||||
of the public at large and to the detriment of our heirs and
|
|
||||||
successors. We intend this dedication to be an overt act of
|
|
||||||
relinquishment in perpetuity of all present and future rights to this
|
|
||||||
software under copyright law.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
||||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
For more information, please refer to <https://unlicense.org>
|
|
6
Makefile
6
Makefile
|
@ -1,7 +1,5 @@
|
||||||
.PHONY: dry-run
|
|
||||||
dry-run:
|
dry-run:
|
||||||
ansible-playbook playbooks/*.yaml --check --diff
|
ansible-playbook playbook.yaml --check --diff
|
||||||
|
|
||||||
.PHONY: run
|
|
||||||
run:
|
run:
|
||||||
ansible-playbook playbooks/*.yaml
|
ansible-playbook playbook.yaml
|
||||||
|
|
10
README.md
10
README.md
|
@ -3,13 +3,3 @@ Server management
|
||||||
|
|
||||||
## vault
|
## vault
|
||||||
Create a `vault.pass` file with the ansible vault password.
|
Create a `vault.pass` file with the ansible vault password.
|
||||||
|
|
||||||
## initial setup
|
|
||||||
```shell
|
|
||||||
ansible-playbook playbooks/dependencies/*.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
## run
|
|
||||||
```shell
|
|
||||||
ansible-playbook playbooks/*.yaml
|
|
||||||
```
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
[servers]
|
[servers]
|
||||||
ubuntu ansible_host=192.168.0.6 ansible_port=38303 ansible_python_interpreter=auto_silent
|
192.168.0.6:38303 ansible_python_interpreter=auto_silent
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
- name: lyon-transports
|
- name: lyon-transports
|
||||||
hosts: servers
|
hosts: servers
|
||||||
tasks:
|
tasks:
|
||||||
- name: write service file
|
- name: write lyon-transports unit file
|
||||||
become: true
|
become: true
|
||||||
template:
|
template:
|
||||||
src: ../templates/lyon-transports.service.j2
|
src: templates/lyon-transports.service.j2
|
||||||
dest: /etc/systemd/system/lyon-transports.service
|
dest: /etc/systemd/system/lyon-transports.service
|
||||||
notify:
|
notify:
|
||||||
- daemon-reload
|
- daemon-reload
|
||||||
- restart lyon-transports
|
- restart lyon-transports
|
||||||
- name: flush handlers
|
- name: ensure lyon-transports is running
|
||||||
meta: flush_handlers
|
|
||||||
- name: ensure service is running
|
|
||||||
become: true
|
become: true
|
||||||
service:
|
service:
|
||||||
name: lyon-transports
|
name: lyon-transports
|
||||||
|
@ -23,7 +21,7 @@
|
||||||
become: true
|
become: true
|
||||||
systemd:
|
systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
- name: restart service
|
- name: restart lyon-transports
|
||||||
become: true
|
become: true
|
||||||
service:
|
service:
|
||||||
name: lyon-transports
|
name: lyon-transports
|
|
@ -1,7 +0,0 @@
|
||||||
- name: clean ansible venv
|
|
||||||
hosts: servers
|
|
||||||
tasks:
|
|
||||||
- name: remove virtualenv
|
|
||||||
file:
|
|
||||||
path: /tmp/ansible
|
|
||||||
state: absent
|
|
|
@ -1,18 +0,0 @@
|
||||||
- name: setup ansible python dependencies
|
|
||||||
hosts: servers
|
|
||||||
tasks:
|
|
||||||
- name: install system deps
|
|
||||||
become: true
|
|
||||||
apt:
|
|
||||||
pkg:
|
|
||||||
- python3-venv
|
|
||||||
- name: setup venv
|
|
||||||
shell: |
|
|
||||||
if [ -x /tmp/ansible/bin/python ]; then exit 123; fi
|
|
||||||
/usr/bin/python3 -m venv /tmp/ansible
|
|
||||||
/tmp/ansible/bin/pip install --upgrade 'github3.py >= 1.0.0a3'
|
|
||||||
args:
|
|
||||||
executable: /bin/bash
|
|
||||||
register: venv
|
|
||||||
changed_when: "venv.rc != 123"
|
|
||||||
failed_when: "venv.rc != 0 and venv.rc != 123"
|
|
|
@ -1,69 +0,0 @@
|
||||||
- name: goatcounter
|
|
||||||
hosts: servers
|
|
||||||
tasks:
|
|
||||||
- name: get latest release
|
|
||||||
github_release:
|
|
||||||
action: latest_release
|
|
||||||
user: arp242
|
|
||||||
repo: goatcounter
|
|
||||||
register: release
|
|
||||||
- name: print release
|
|
||||||
ansible.builtin.debug:
|
|
||||||
var: release.tag
|
|
||||||
- name: download binary
|
|
||||||
get_url:
|
|
||||||
url: https://github.com/arp242/goatcounter/releases/download/{{release.tag}}/goatcounter-{{release.tag}}-linux-amd64.gz
|
|
||||||
dest: "{{base_dir}}/goatcounter-{{release.tag}}.gz"
|
|
||||||
- name: uncompress
|
|
||||||
command: gunzip {{base_dir}}/goatcounter-{{release.tag}}.gz
|
|
||||||
args:
|
|
||||||
creates: "{{base_dir}}/goatcounter-{{release.tag}}"
|
|
||||||
- name: make executable
|
|
||||||
file:
|
|
||||||
path: "{{base_dir}}/goatcounter-{{release.tag}}"
|
|
||||||
mode: '0775'
|
|
||||||
- name: symlink
|
|
||||||
file:
|
|
||||||
src: "{{base_dir}}/goatcounter-{{release.tag}}"
|
|
||||||
dest: "{{base_dir}}/goatcounter"
|
|
||||||
state: link
|
|
||||||
- name: write service unit file
|
|
||||||
become: true
|
|
||||||
template:
|
|
||||||
src: ../templates/goatcounter.service.j2
|
|
||||||
dest: /etc/systemd/system/goatcounter.service
|
|
||||||
notify:
|
|
||||||
- daemon-reload
|
|
||||||
- restart goatcounter
|
|
||||||
- name: flush handlers
|
|
||||||
meta: flush_handlers
|
|
||||||
- name: ensure service is running
|
|
||||||
become: true
|
|
||||||
service:
|
|
||||||
name: goatcounter
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
handlers:
|
|
||||||
- name: daemon-reload
|
|
||||||
become: true
|
|
||||||
systemd:
|
|
||||||
daemon_reload: true
|
|
||||||
- name: restart service
|
|
||||||
become: true
|
|
||||||
service:
|
|
||||||
name: goatcounter
|
|
||||||
state: restarted
|
|
||||||
|
|
||||||
vars:
|
|
||||||
ansible_python_interpreter: /tmp/ansible/bin/python
|
|
||||||
base_dir: /mnt/data/goatcounter
|
|
||||||
gc_mailgun_api_key: !vault |
|
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
|
||||||
31386237653033306338393237353961396535363061363931643863653461333631376365663338
|
|
||||||
3266346337353564656539666235656265356435343834380a616232383839663639616537393233
|
|
||||||
64303764306639636136346233366666633765393565353062396632636163643031616235303130
|
|
||||||
3662343162643033380a326161313036643835636562636165356464393236303533303435353365
|
|
||||||
36336163313338346235396565363631366564393562326536353262363637653432643830663532
|
|
||||||
30356133383335653330613965623261323531613131663437363430636565393262353565326132
|
|
||||||
323830313235313462633335333763363161
|
|
|
@ -1,13 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Goatcounter
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart={{base_dir}}/goatcounter serve -listen *:8081 -tls http -smtp smtps://goatcounter%%40mg.augendre.info:{{gc_mailgun_api_key}}@smtp.mailgun.org:587 -email-from goatcounter@mg.augendre.info -automigrate -db sqlite+{{base_dir}}/db/goatcounter.sqlite3
|
|
||||||
Type=simple
|
|
||||||
Restart=always
|
|
||||||
User=gaugendre
|
|
||||||
Group=gaugendre
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
Loading…
Reference in a new issue