aboutsummaryrefslogtreecommitdiff
path: root/ansible/odoo/odoo.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/odoo/odoo.yml')
-rw-r--r--ansible/odoo/odoo.yml48
1 files changed, 48 insertions, 0 deletions
diff --git a/ansible/odoo/odoo.yml b/ansible/odoo/odoo.yml
new file mode 100644
index 0000000..0097294
--- /dev/null
+++ b/ansible/odoo/odoo.yml
@@ -0,0 +1,48 @@
+- hosts:
+ - numquam
+ tasks:
+ - become: yes
+ copy:
+ dest: /etc/systemd/system/docker.odoo.service
+ content: |
+ [Unit]
+ After=docker.service
+ Requires=docker.service
+
+ [Service]
+ TimeoutStartSec=0
+ Restart=always
+ ExecStartPre=-/usr/bin/docker stop odoo
+ ExecStartPre=-/usr/bin/docker rm odoo
+ ExecStartPre=/usr/bin/docker pull odoo
+ ExecStart=/usr/bin/docker run \
+ -e HOST=172.17.0.1 \
+ -e PORT=5432 \
+ -e USER=odoo \
+ -e PASSWORD=odoo \
+ -p 8069:8069 \
+ --name odoo -t \
+ odoo
+
+ [Install]
+ WantedBy=multi-user.target
+ register: service_file
+
+ - become: yes
+ systemd:
+ daemon_reload: yes
+ when: service_file.changed
+
+ - become: yes
+ systemd:
+ unit: docker.odoo.service
+ enabled: yes
+ state: started
+ when: not service_file.changed
+
+ - become: yes
+ systemd:
+ unit: docker.odoo.service
+ enabled: yes
+ state: restarted
+ when: service_file.changed