You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
152 lines
3.3 KiB
152 lines
3.3 KiB
Deploy the Ansible roles
|
|
- Create a requirements.yml file and indicate there the git repos to source the Ansible roles from. See http://docs.ansible.com/ansible/latest/galaxy.html#installing-roles
|
|
|
|
host> nano requirements.yml
|
|
|
|
# from GitHub
|
|
- name: ansible-odoo
|
|
src: https://github.com/osiell/ansible-odoo
|
|
version: origin/master
|
|
|
|
- name: postgresql
|
|
src: https://github.com/ANXS/postgresql
|
|
|
|
- name: ansible-odoo-nginx
|
|
src: https://github.com/Eficent/ansible-odoo-nginx
|
|
|
|
- name: ansible-role-certbot
|
|
src: https://github.com/geerlingguy/ansible-role-certbot
|
|
|
|
host> sudo ansible-galaxy install -r requirements.yml
|
|
|
|
- changing role ansible-odoo from origin/master to origin/master
|
|
- extracting ansible-odoo to /home/jordi/.ansible/roles/ansible-odoo
|
|
- ansible-odoo (origin/master) was installed successfully
|
|
- changing role postgresql from to unspecified
|
|
- extracting postgresql to /home/jordi/.ansible/roles/postgresql
|
|
- postgresql was installed successfully
|
|
- extracting ansible-odoo-nginx to /home/jordi/.ansible/roles/ansible-odoo-nginx
|
|
- ansible-odoo-nginx was installed successfully
|
|
- adding dependency: geerlingguy.nginx
|
|
- extracting ansible-role-certbot to /home/jordi/.ansible/roles/ansible-role-certbot
|
|
- ansible-role-certbot was installed successfully
|
|
- downloading role 'nginx', owned by geerlingguy
|
|
- downloading role from https://github.com/geerlingguy/ansible-role-nginx/archive/2.5.0.tar.gz
|
|
- extracting geerlingguy.nginx to /home/jordi/.ansible/roles/geerlingguy.nginx
|
|
- geerlingguy.nginx (2.5.0) was installed successfully
|
|
|
|
|
|
Note: use --force to ensure that the latest version of the roles is installed.
|
|
|
|
Install LXC Container
|
|
This is only to test locally the execution of the ansible playbook on a target host.
|
|
|
|
Create the LXC container:
|
|
|
|
host> sudo lxc-create -t debian -n odoo10
|
|
|
|
Start the LXC container:
|
|
|
|
host> sudo lxc-start -n odoo10 -d
|
|
|
|
Check that the container is up
|
|
|
|
host> sudo lxc-ls -f
|
|
|
|
NAME STATE AUTOSTART GROUPS IPV4 IPV6
|
|
|
|
odoo10 RUNNING 0 - 10.0.3.217 -
|
|
|
|
Attach to the container
|
|
|
|
host> sudo lxc-attach -n odoo10
|
|
|
|
Install nano:
|
|
|
|
container> apt-get install nano
|
|
|
|
Install python
|
|
|
|
container> apt-get install python
|
|
|
|
Allow root to connect over ssh:
|
|
|
|
container> nano /etc/ssh/sshd_config
|
|
|
|
FROM:
|
|
|
|
PermitRootLogin without-password TO:
|
|
|
|
PermitRootLogin yes
|
|
|
|
Restart ssh
|
|
|
|
container> /etc/init.d/ssh restart
|
|
|
|
Provide a password to root:
|
|
|
|
container> passwd
|
|
|
|
|
|
|
|
Exit from the container and try to ssh into it with the new user
|
|
|
|
container>exit
|
|
|
|
host> ssh root@10.0.3.217
|
|
|
|
|
|
Create Hosts Inventory File
|
|
|
|
Create a project folder under home dir.
|
|
|
|
host> mdir ansible-test && cd ansible-test
|
|
|
|
host> nano inventory
|
|
|
|
odoo10 ansible_ssh_host=10.0.3.217
|
|
|
|
|
|
|
|
Create Playbook File
|
|
|
|
host/ansible-test> nano ./playbook.yml
|
|
|
|
- name: Odoo 10
|
|
|
|
hosts: odoo10
|
|
|
|
roles:
|
|
|
|
- postgresql
|
|
|
|
- ansible-odoo
|
|
|
|
vars:
|
|
|
|
# [postgresql]
|
|
|
|
- postgresql_version: 9.3
|
|
|
|
# [odoo]
|
|
|
|
- odoo_version: 11.0
|
|
|
|
- odoo_install_type: pip
|
|
|
|
- odoo_config_unaccent: True
|
|
|
|
- odoo_pip_requirements_url: https://raw.githubusercontent.com/Eficent/sample-oca-pip-requirements/11.0/requirements.txt
|
|
|
|
- odoo_config_admin_passwd: SuPerPassWorD
|
|
|
|
- odoo_config_addons_path: ""
|
|
|
|
environment:
|
|
|
|
LC_ALL: en_US.UTF-8
|
|
|
|
Deploy the Playbook to the container
|
|
|
|
host> ansible-playbook -i inventory playbook.yml -e "ansible_ssh_user=root" -k -v
|