This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
alain.yml
183 lines (159 loc) · 6.09 KB
/
alain.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
- hosts: alains
vars:
alain_twitter_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
39633966646630383235343735343336376637363230336163313664356630383736613730613037
3232626236316132653832333033613934353130376636660a616461326532616364333764656333
36363632656333353539396239663232333938633161323938623061316131613434343632396139
3339376261303962610a363436366136626238623632363166623463363137666261376666613733
64613961363332336365623035336664643436303739666135303037613232353765
alain_twitter_secret: !vault |
$ANSIBLE_VAULT;1.1;AES256
66303530396633333961656662613038306361316635343239613739383933396261353531376161
3561316336633964313063303863386235653637623966630a636131653761646430303038386636
39623364373131636338386466643237383063623239316138316463396565393031386635353633
3738636130363236640a383866393066336265356230393762663830633139623532343839396632
35633466646235636335353163356462656161653734643734663537373763653531376133373035
38396362393961383930383932343334363961663263313932333539386332666361643537633738
646666613437653163613537643034346163
alain_twitter_token: !vault |
$ANSIBLE_VAULT;1.1;AES256
32366631626565633965643530306238333434366563343736613936303631643430653361373764
3736306665643331366439633638386236633165303631650a346339373564623562313938323966
30333431346437656134373135303339633635373465383561653830636634363538393931633966
6434333933396466620a313832323336643464373166353161376234646261653631353938613731
37323363353236626631363862383232316332316633363466383531346635663339363063653663
37656563383163353565396461343565333930343264366535623137373265663337356139343531
663737653935393866633063383239326661
alain_twitter_token_secret: !vault |
$ANSIBLE_VAULT;1.1;AES256
30383237616136316130626638303734386137306434373535356136636164643139343932323263
6333396635336533366434356131326230653532613535340a303962343263313937396434373839
64663833316134343434613430316465353335356462366137633163646632363161353535303238
3363363962393533620a303864633134643565346431363262663535336433613534333662663461
61303635656164376238303432353738393839383533316630383339613663303531363637336665
3661623038613335313234393364326564663333353936316462
tasks:
- name: La naissance d'Alain
user:
name: alain
system: true
- name: Le cerveau d'Alain
become: true
become_user: alain
git:
repo: https://github.com/afpy/alain/
dest: ~alain/src/
notify: restart alain
- name: Alain s'installe dans sa maison
become: true
become_user: alain
pip:
name: /home/alain/src/
virtualenv_command: /usr/bin/python3 -m venv
virtualenv: "/home/alain/venv/"
- name: Le bazar d'Alain
file:
state: directory
path: /home/alain/log/
owner: alain
group: alain
mode: 0755
- name: Alain découvre les internets
notify: restart alain
copy:
dest: /etc/systemd/system/alain.service
content: |
[Unit]
Description=Alain
After=network.target
[Service]
Type=simple
ExecStart=/home/alain/venv/bin/irc3 --logdir=/home/alain/log alain.ini
User=alain
Group=alain
WorkingDirectory=/home/alain/src/
Restart=on-failure
[Install]
WantedBy=multi-user.target
- name: Les petits secrets d'Alain
copy:
dest: /home/alain/src/alain.ini
owner: alain
group: alain
mode: 0660
content: |
[bot]
nick = alain_afpy
username = alain
realname = I'm the AFPy mascot
host = irc.libera.chat
port = 7000
ssl = true
includes =
irc3.plugins.core
irc3.plugins.ctcp
irc3.plugins.feeds
irc3.plugins.human
irc3.plugins.logger
irc3.plugins.uptime
alain.alain3
channel = afpy
autojoins =
afpy
[twitter]
key = {{ alain_twitter_key }}
secret = {{ alain_twitter_secret }}
token = {{ alain_twitter_token }}
token_secret = {{ alain_twitter_token_secret }}
[irc3.plugins.command]
cmd = !
guard = irc3.plugins.command.mask_based_policy
[irc3.plugins.logger]
filename = /var/www/logs.afpy.org/log-{date:%Y-%m-%d}.txt
[irc3.plugins.logger.formatters]
privmsg = {date:%H:%M} <{mask.nick}> {data}
[irc3.plugins.command.masks]
gawel!~gael@amandine.bearstech.com = all_permissions
jpcw!jpcw@*.camguilhem.net = all_permissions
mdk!~mdk@python/psf/mdk = all_permissions
feth!*@*.tutu.info = all_permissions
* = view
[irc3.plugins.feeds]
delay = 20
directory = ~/.irc3/feeds/
dispatcher = alain.alain3.feed_dispatcher
channels = afpy
planet = https://planet.afpy.org/atom.xml
planet.fmt = {entry.title} - {entry.link}
planet.delay = 20
notify: restart alain
- service: name=alain enabled=yes state=started daemon_reload=yes
- name: La serrure de la maison d'Alain
file:
state: directory
path: /home/alain/.ssh/
owner: alain
group: alain
mode: 0755
- name: La clef de la maison d'Alain
copy:
content: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMx6KkjC7HAId4/nFnkiHxUb8d7ybJlfLbFu2NFKXpqI github-ci"
dest: /home/alain/.ssh/authorized_keys
owner: alain
group: alain
mode: 0644
- name: Alain peut se redémarrer tout seul
lineinfile:
path: /etc/sudoers
state: present
regexp: '^alain '
line: "alain ALL = NOPASSWD: /bin/systemctl restart alain.service"
validate: /usr/sbin/visudo -cf %s
handlers:
- name: restart alain
systemd:
daemon_reload: true
state: restarted
name: alain