Skip to content

Commit

Permalink
Refactor into a Single Release
Browse files Browse the repository at this point in the history
  - multi OS support
  - initialize web configuration tool
  - upgrade devsec.hardening to 7.13.2
  • Loading branch information
rchenzheng committed Dec 12, 2021
1 parent 9497ad5 commit 2ead550
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 12 deletions.
5 changes: 2 additions & 3 deletions 3cx_install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


tasks:
# It is required to install while in the terminal as it's an interactive installation
- name: HOW TO INSTALL & SETUP?
- name: HOW TO CONFIGURE & SETUP?
debug:
msg: "TO INSTALL and SETUP run `sudo apt install 3cxpbx`"
msg: "Access configuration wizard through a browser http://{{ ansible_default_ipv4.address }}:5015"
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
REMOTE_IP=10.1.1.254
VAGRANT_HOST_IP=192.168.56.254
USER=root
OS=debian/buster64

build: ansible-galaxy
vagrant up
OS=${OS} IP=${VAGRANT_HOST_IP} vagrant up

ansible-galaxy:
ansible-galaxy collection install -r requirements.yaml

test: build
ansible-playbook -i "10.1.1.254", 3cx_install.yaml
ansible-playbook -i "${VAGRANT_HOST_IP}", 3cx_install.yaml

install: ansible-galaxy
ansible-playbook -i "${REMOTE_IP}", 3cx_install.yaml -e ansible_ssh_user=${USER}

clean:
vagrant destroy -f && rm -rf .vagrant
OS=${OS} IP=${VAGRANT_HOST_IP} vagrant destroy -f && rm -rf .vagrant

.PHONY: clean test ansible-galaxy
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Requirements
- Ansible 2.9+
- Debian Buster (3CX)
- Vagrant 2.2.7 (testing)
- Debian Stretch `debian/stretch64` `V16` or Buster `debian/buster64` `V18`
- Vagrant 2.2.7+ (testing)

## Deployment ##

Expand Down
5 changes: 3 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def define_vm(config, hostname, ip)
public_key = IO.read(public_key_path)

config.vm.define hostname do |vm|
vm.vm.box = "debian/buster64"
vm.vm.box = "#{ENV['OS']}"
vm.vm.hostname = hostname
vm.vm.network 'private_network', ip: ip

Expand All @@ -19,5 +19,6 @@ def define_vm(config, hostname, ip)
end

Vagrant.configure("2") do |config|
define_vm(config, "3cx-pbx", "10.1.1.254")
define_vm(config, "3cx-pbx", "#{ENV['IP']}")
config.vm.synced_folder ".", "/vagrant", disabled: true
end
2 changes: 1 addition & 1 deletion requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
collections:
- name: devsec.hardening
version: 7.10.0
version: 7.13.2
source: https://galaxy.ansible.com
4 changes: 4 additions & 0 deletions roles/3cx-setup/handlers/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
systemd:
name: fail2ban
state: restarted

- name: start 3cx
command:
cmd: /usr/sbin/3CXLaunchWebConfigTool
5 changes: 4 additions & 1 deletion roles/3cx-setup/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
repo: deb http://downloads-global.3cx.com/downloads/debian {{ ansible_lsb.codename }} main
state: present

- name: update cache
- name: install 3cx
apt:
name: 3cxpbx
update_cache: yes
state: latest
notify: start 3cx
1 change: 1 addition & 0 deletions roles/ssh-access/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
- name: add {{ user }} user to sudoers
user:
name: "{{ user }}"
Expand Down

0 comments on commit 2ead550

Please sign in to comment.